2016 Update

This commit is contained in:
Tina Müller 2016-12-05 22:15:40 +01:00
parent 948b86eafa
commit dcf5d15da3
7965 changed files with 139854 additions and 31002 deletions

View file

@ -1,9 +1,15 @@
Some programming languages have ways of expressing integer literals in bases other than the normal base ten.
;Task:
Show how integer literals can be expressed in as many bases as your language allows.
Note: this should '''not''' involve the calling of any functions/methods but should be interpreted by the compiler or interpreter as an integer written to a given base.
Note:   this should '''not''' involve the calling of any functions/methods, but should be interpreted by the compiler or interpreter as an integer written to a given base.
Also show any other ways of expressing literals, e.g. for different types of integers.
See also [[Literals/Floating point]].
;Related task:
*   [[Literals/Floating point]]
<br><br>

View file

@ -0,0 +1,2 @@
display B#10 ", " O#01234567 ", " -0123456789 ", "
H#0123456789ABCDEF ", " X#0123456789ABCDEF ", " 1;2;3;4

View file

@ -0,0 +1,2 @@
if 1234 = 1,2,3,4 then display "Decimal point is not comma" end-if
if 1234 = 1;2;3;4 then display "literals are equal, semi-colons ignored" end-if

View file

@ -0,0 +1,2 @@
#var n := 1234. // decimal number
#var x := 1234h. // hexadecimal number

View file

@ -0,0 +1,4 @@
const
INT_VALUE = 15;
OCTAL_VALUE = &017;
BINARY_VALUE = %1111;

View file

@ -1,6 +1,8 @@
thing = 37
thing = '37' /*this is exactly the same as above. */
thing = "37" /*this is exactly the same as above also. */
thing = '25'x /*this as well, expressed in hexadecimal. */
thing = '00100101'b /*this too, expressed as binary. */
say 'base 10=' thing
say 'base 2=' x2b(d2x(thing))