Conditional structures: Difference between revisions

Content added Content deleted
No edit summary
(→‎{{header|Beeswax}}: Beeswax language example added)
Line 672: Line 672:
REM ON ... PROC (ELSE clause is optional):
REM ON ... PROC (ELSE clause is optional):
ON expression% PROCone, PROCtwo ... ELSE statements</lang>
ON expression% PROCone, PROCtwo ... ELSE statements</lang>

=={{header|Beeswax}}==

beeswax has 4 conditional operators that act like the ternary '''?:''' operator in C or Julia. Due to the 2-dimensional nature of beeswax it is possible to realize complex branching structures this way.

The 4 conditional operators are:
<lang Beeswax>
' lstack top value == 0 ? skip next instruction : don’t skip next instruction.
" lstack top value > 0 ? skip next instruction : don’t skip next instruction.
K lstack top value == 2nd value ? skip next instruction : don’t skip next instruction.
L lstack top value > 2nd value ? skip next instruction : don’t skip next instruction.</lang>

Example:
<lang Beeswax>_`Enter integer n:`T'p`n = 0`>N`Enter integer m:`T'p`m = 0`>` and `Kp`m = n`;
>`n > 0`d >`m > 0`d >Lp`m > n`;
>`m < n`;</lang>

Example output:
<lang Beeswax>Enter integer n:
i3
n > 0
Enter integer m:
i0
m = 0 and m < n</lang>


=={{header|Befunge}}==
=={{header|Befunge}}==