Inverted syntax: Difference between revisions

Line 456:
 
=={{header|M2000 Interpreter}}==
There is no way to have inverted syntax for conditionals, except for using lambda functions. Two more things we can do. One to invert the way we call a module, passing statements before calling the module. The Second by using Let we make a Push and then a Read, so first evaluated the right expression and then the left. Here we change a global variable in the right expression and we change the index of array where we set the returned value from function.
 
<lang M2000 Interpreter>
expr=lambda ->{
Print "ok"
}
ifrev=lambda (dothis, cond) ->{
if cond then call dothis()
}
a=1
call ifrev(expr, a=1)
 
\\ on module call
Module Subtract (a, b) {
Anonymous user