62 lines
1.6 KiB
Java
62 lines
1.6 KiB
Java
<h2>Comments</h2>
|
|
<pre><code>BTW Single line comment
|
|
OBTW Multi-line
|
|
comment TLDR</code></pre>
|
|
|
|
<h2>Strings and special characters</h2>
|
|
<pre><code>"foo :"bar:" baz"
|
|
"foo:)bar:>baz"
|
|
"Interpolation :{works} too!"</code></pre>
|
|
|
|
<h2>Numbers</h2>
|
|
<pre><code>42
|
|
-42
|
|
123.456</code></pre>
|
|
|
|
<h2>Variable declaration</h2>
|
|
<pre><code>I HAS A var
|
|
var R "THREE"
|
|
var R 3</code></pre>
|
|
|
|
<h2>Types</h2>
|
|
<pre><code>MAEK some_expr A YARN
|
|
some_var IS NOW A NUMBR</code></pre>
|
|
|
|
<h2>Full example</h2>
|
|
<pre><code>OBTW Convert a number to hexadecimal. This
|
|
is returned as a string.
|
|
TLDR
|
|
HOW IZ I decimal_to_hex YR num
|
|
I HAS A i ITZ 0
|
|
I HAS A rem
|
|
I HAS A hex_num ITZ A BUKKIT
|
|
I HAS A decimal_num ITZ num
|
|
IM IN YR num_loop
|
|
rem R MOD OF decimal_num AN 16
|
|
I HAS A hex_digit
|
|
rem, WTF?
|
|
OMG 10, hex_digit R "A", GTFO
|
|
OMG 11, hex_digit R "B", GTFO
|
|
OMG 12, hex_digit R "C", GTFO
|
|
OMG 13, hex_digit R "D", GTFO
|
|
OMG 14, hex_digit R "E", GTFO
|
|
OMG 15, hex_digit R "F", GTFO
|
|
OMGWTF, hex_digit R rem
|
|
OIC
|
|
hex_num HAS A SRS i ITZ hex_digit
|
|
decimal_num R QUOSHUNT OF decimal_num AN 16
|
|
BOTH SAEM decimal_num AN 0, O RLY?
|
|
YA RLY, GTFO
|
|
NO WAI, i R SUM OF i AN 1
|
|
OIC
|
|
IM OUTTA YR num_loop
|
|
I HAS A hex_string ITZ A YARN
|
|
IM IN YR string_reverse
|
|
DIFFRINT i AN BIGGR OF i AN 0, O RLY?
|
|
YA RLY, GTFO
|
|
OIC
|
|
hex_string R SMOOSH hex_string AN hex_num'Z SRS i MKAY
|
|
i R DIFF OF i AN 1
|
|
IM OUTTA YR string_reverse
|
|
FOUND YR hex_string
|
|
IF U SAY SO</code></pre> |