- Bytecode
- Configuration
- Comments
// - Conditions
ifelseend - Constants
truefalseHIGHLOWINPUTOUTPUT - Cycles
forwhilebreakcontinue - Functions
functionlocalsreturndone - Macros
macro - Numeric variables
@@[] - Operators
+-*/%==!=>>=<<=&&||&|^>><<++--~not - Strings
::[] - System functions
adc readargscharcursordelayfile closefile openfile readfile writepipe closepipe openpipe readpipe writeincludeindexinputio openio readio writememmillisnumbernumericprintrandomrestartserial openserial readserial writesizestopstring - Unary operators
++--
for [variable assignment] to [expression] step [expression]
[statement]
next
The for is a cycle that supports a single local variable identified by # that can be set with an initial value and a limit value that is specified after to:
for #i = 0 to 5
print #i
next
// Prints 0, 1, 2, 3, 4In the example above #i is locally declared with a value of 0 and it will be incremented by 1 at each cycle. The for iterates the local variable up or down to the desired limit in both directions:
for #i = 5 to 0
print #i
next
// Prints 5, 4, 3, 2, 1Each time next is encountered the variable is incremented or decremented by 1 and the cycle restarts if the limit defined after the to is not reached. Consider that for, unlike for defined by other programming languages, evaluates and computes the limit the first time the for statement is encountered. For this reason the for is a quick iterator, if you need to conditionally exit from a loop use while instead.
Optionally the for the increment or decrement value can be configured after step:
for #i = 0 to 10 step 2
print #i
next
// Prints 0, 2, 4, 6, 8The BIPLAN for supports break as other programming languages do:
for #i = 0 to 5
if #i == 2 break end
print #i
next
print "Finished"
// Prints 0, 1, FinishedWhen break is encountered within a for, the iteration is interrupted and all following statements part of the for are ignored.
The BIPLAN for supports continue as other programming languages do:
for #i = 0 to 5
if #i == 2 continue end
print #i
next
print "Finished"
// Prints 0, 1, 3, 4, FinishedWhen continue is encountered within a for, all following statements part of the for are ignored and the next iteration is initiated.
while [condition]
[statement]
next
The while statement, if the condition is truthy, forces the cyclical execution of the following statements until next is encountered.
while io read 12 == HIGH
print "The pin is HIGH"
next
// Prints The pin is HIGH until pin 12 is HIGHThe BIPLAN while supports break as other programming languages do:
while true
if io read 12 == HIGH
break
end
next
print "Button pressed!"
// Prints Button pressed when pin 12 is HIGHWhen break is encountered within a for, the iteration is interrupted and all following statements part of the for are ignored.
The BIPLAN while supports continue as other programming languages do:
@treshold = 512
while true
if adc read A0 > @treshold
continue
else
print "Alert"
end
next
// Prints Alert if the reading is less than 512When continue is encountered within a for, all following statements part of the for are ignored and the next iteration is initiated.