Inverted syntax: Difference between revisions

Content deleted Content added
Chunes (talk | contribs)
added Factor
No edit summary
Line 454:
Do I need an umbrella? Yes
</pre>
 
=={{header|M2000 Interpreter}}==
There is no way to have inverted syntax for conditionals. Two 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>
\\ on module call
Module Subtract (a, b) {
Push a-b
}
Module PrintTop {
Print Number
}
Subtract 10, 3 : PrintTop
\\ pushing before calling in reverse order
Push 3, 10 : Subtract : PrintTop
\\ on assigment
Dim A(5)=1
Global n=2
Function AddOne (x) {
n++
=x
}
\\ Execution of left expression, then right expression
A(n)=AddOne(5)
Print A(n-1)=5, n=3
\\ Execution of right expression, then left expression
Let A(n)=AddOne(15)
Print A(n)=15, n=4
\\ This statement..
Let X=1, Y=2
\\ executed like these
Push 2, 1 : Read X, Y
</lang>
 
 
=={{header|m4}}==