2
All SILOS programs can optionally have a macro statement on the second line
Consider the following program... One of my favorite SILOS submissions by betseg.
a=97 def q print z bottle v beer L Line g wall x IntNoLine h the c around qL 99 zs of v on h g, 99 zs of v. lbls q Take one down and pass it c, a+1 qx a qL zs of v on h g. qx a q zs of v on h g, qx a qL zs of v. a-2 if a s qL Take one down and pass it c, 1 z of v on h g. qL 1 z of v on h g, 1 z of v. q Go to h store and buy some more, 99 zs of v on h g.
Look at that savings Try it out!
1
Consider a challege where we should output the input if it is not 0 and output -1 otherwise. We could do the following.
readIO
if i b
print -1
GOTO c
lblb
printInt i
lblc
However, that is far from optimal. The "superior" solution would be this.
readIO
j=i
i/i
j=j+i-1
printInt j
SILOS will quietly ignore the division by 0, which results in a no-op.
0
There is no need to declare a variable. All variables are automatgically initialized to 0.
Hence, this-
a=0 a=97 printInt a
Is the same as this
a=97 printInt a