Anonymous user
Inverted syntax: Difference between revisions
→{{header|M2000 Interpreter}}
Line 456:
=={{header|M2000 Interpreter}}==
There is no way to have inverted syntax for conditionals, except for using lambda functions.
The third one is more complicated. We make a callback function which act as code of a module, with same scope, and use a module to check condition before we call the callback function
<lang M2000 Interpreter>
Line 498 ⟶ 499:
\\ executed like these
Push 2, 1 : Read X, Y
\\ This is the CallBack way
Module ExecCond {
Read &callback(), cond
if cond then call callback()
}
x=1
\\ this aa() is a function but when we call it after transforming from Lazy$()
\\ act as part of module so we see x, and alter it
Function aa {
x++
}
a=1
ExecCond Lazy$(&aa()), A=1
Print x=2
</lang>
|