Named parameters: Difference between revisions

No edit summary
Line 817:
=={{header|M2000 Interpreter}}==
We can use named parameters for modules only. Modules are like functions but can't be called from expressions. We can use current stack to return values using Push statement. Here we define type and we set values to make them optionals.
Passing optionals in modules may cause problems if we have values in stack, so we can use Stack New {] to open an empty current stack (the old one is hidden until exit from that block), or using ? as "use standard value".
 
<lang M2000 Interpreter>
Line 823 ⟶ 824:
Print type$(y), y
}
 
namedparam 10, 20
namedparam ?, ?
Line 830:
\\ it is empty
namedparam
namedparam %y=500
namedparam %x=20
}
namedparam %y=500
namedparam %x=20
namedparam %x=1, %y=1
</lang>
Anonymous user