Non-decimal radices/Input: Difference between revisions

Content added Content deleted
(Added F# version)
(Added FreeBASIC)
Line 350: Line 350:


end program</lang>
end program</lang>

=={{header|FreeBASIC}}==
FreeBASIC has built-in string to integer conversion functions which automatically recognize numbers in hexadecimal,
decimal, octal or binary format provided that they are prefixed by &H, (nothing), &O and &B respectively. Here's
an example:
<lang freebasic>' FB 1.05.0 Win64

Dim s(1 To 4) As String = {"&H1a", "26", "&O32", "&B11010"} '' 26 in various bases
For i As Integer = 1 To 4
Print s(i); Tab(9); "="; CInt(s(i))
Next

Sleep</lang>

{{out}}
<pre>
&H1a = 26
26 = 26
&O32 = 26
&B11010 = 26
</pre>

=={{header|Go}}==
=={{header|Go}}==
<lang go>package main
<lang go>package main