- Bytecode
- Configuration
- Comments
#
- Conditions
if
else
end
- Constants
true
false
HIGH
LOW
INPUT
OUTPUT
- Cycles
for
while
next
break
continue
- Functions
function
locals
return
- Macros
macro
- Numeric variables
@
@[]
- Operators
+
-
*
/
%
==
!=
>
>=
<
<=
&&
||
&
|
^
>>
<<
++
--
~
not
- Strings
:
:[]
- System functions
adc read
args
char
cursor
delay
file close
file open
file read
file write
include
index
input
io open
io read
io write
jump
label
mem
millis
number
numeric
print
random
restart
serial open
serial read
serial write
size
stop
string
system
- Unary operators
++
--
if [relation] [statement] end
if [relation] [statement]
else [statement] end
if [relation]
[statement]
end
if [relation]
[statement]
else
[statement]
end
An if
, if its condition is truthy, executes the following statements until end
is encountered, otherwise it executes the statements that follow the next end
or the next else
until end
is encountered. It is used where code needs to be executed only if a given condition is true. An if
or else
statement can execute a single statement and fit in a single line:
@fine = true
if @fine print "All is fine!" end
// Or
if not @fine print "Some error occurred"
else print "All is fine!" end
or can also conditionally execute a group of statements:
# Condition block
if 1 == 1
print "All is fine!"
print "Equality works"
else
print "Some error occurred!"
print "Equality does not work"
end