Re: OT: Number bases
From: | Mark J. Reed <markjreed@...> |
Date: | Thursday, February 12, 2009, 14:38 |
>> What programming language do you use that allows writing binary
>> integer literals with a 0b prefix?
Several "C-inspired" dynamic languages support such a syntax:
$ perl -le 'print 0b101010'
42
$ ruby -e 'puts 0b101010'
42
$ echo 'puts [expr 0b101010]' | tclsh
42
These languages also support going the other way via a '%b' format
directive in their printf() equivalents.
I think it's part of C# as well, but I could be wrong. Many other
likely candidates don't support it (Python, Javascript, Java, PHP...)
--
Mark J. Reed <markjreed@...>