Created
June 15, 2019 09:05
-
-
Save joseoliv/fb8e425f722bba4b6848ab4570c4b936 to your computer and use it in GitHub Desktop.
Number_bin
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package metaobjectTest | |
@doc{* | |
This is a literal number annotation, an identifier follows a literal | |
number. The syntax for this annotation is | |
nbin or nBin or nBIN | |
in which 'n' is a literal number in base 2. 'n' can have numbers and | |
underscores but it should start with a number (otherwise the | |
compiler will consider it as an identifier). The metaobject uses method | |
Integer.valueOf(n, 2) | |
to parse the number 'n' in base 2. | |
*} | |
object Number_bin | |
func run { | |
assert 101bin == 5; | |
assert 10BIN == 2; | |
assert 111_111Bin == 63; | |
} | |
end | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment