-
Notifications
You must be signed in to change notification settings - Fork 0
Blocks
João Pedro Neto edited this page Nov 26, 2020
·
15 revisions
Blocks are yöctọ code surrounded by brackets, { code }
.
There is also an alternative syntax when blocks are just one character, use an umlaut: ¨
These are associated with block functions, like conditionals and loops.
Use | Fraction | String | List | Observations | |
---|---|---|---|---|---|
? |
{code}? |
if pop code
|
ibid. | ibid. | if-then |
⁇ |
{c1}{c2}⁇ |
if pop c1 else c2
|
ibid. | ibid. | if-then-else |
F |
{code}F |
a = pop for ï = 0..a-1 push ï code
|
NA |
pop a for ï in a push ï code
|
for/for-each loop progress variable ï can be used inside |
G |
{code}G |
a = pop for ï = a-1..0 push ï code
|
NA |
pop a for ï in invert(a) push ï code
|
inverted for loop progress variable ï can be used inside |
R |
{code}R |
a = pop repeat a code
|
NA |
a = pop repeat la code
|
same as for but with no progress variable |
W |
{code}W |
while pop code
|
ibid. | ibid. | while loop |
Y |
{code}Y |
a = top do code while top≠a
|
ibid. | ibid. | fixed-point loop |
Notes:
- A non-zero Fraction, any non-empty string, and non-empty lists are considered True
- Blocks allow internal blocks