Literals/Integer: Difference between revisions
Content deleted Content added
Add Uxntal |
|||
(3 intermediate revisions by 3 users not shown) | |||
Line 26:
print(1111'1111b) // binary literal
print(255'000) // decimal literal</syntaxhighlight>
{{out}}
<pre>
Line 37 ⟶ 36:
255000
</pre>
=={{header|4ME}}==
P:
out{255} literal
=={{header|6502 Assembly}}==
Conventions vary between assemblers, but typically a $ represents hexadecimal and a % represents binary. The absence of either of those symbols means decimal. Single or double quotes represent an ASCII value. Keep in mind that without a # in front, any quantity is interpreted as a dereference operation at the memory location equal to the supplied number, rather than a constant value.
Line 504 ⟶ 507:
PRINT BIN(10001)
PRINT ORD(HEX$("11"))</syntaxhighlight>
==={{header|SmallBASIC}}===
<syntaxhighlight lang="qbasic">
print 255 ' Decimal
print 0xFF ' Hexadecimal
print 0hFF ' Hexadecimal
print &xFF ' Hexadecimal
print &hFF ' Hexadecimal
print 0o377 ' Octal
print &o377 ' Octal
print 0b11111111 ' Binary
print &b11111111 ' Binary
</syntaxhighlight>
==={{header|Yabasic}}===
Line 2,395 ⟶ 2,411:
As the only difference between integers and other numbers is that the former do not have a decimal part, it is also possible to represent integers using scientific notation.
<syntaxhighlight lang="
var b = 0xff
var c = 0255 // not an octal literal
|