RosettaCodeData/Task/Function-definition/M2000-Interpreter/function-definition-1.m2000

32 lines
669 B
Plaintext

Module Checkit {
Module Multiply (a, b) {
Push a*b
}
Multiply 10, 5
Print Number=50
Module Multiply {
Push Number*Number
}
Multiply 10, 5
Print Number=50
\\ push before call
Push 10, 5
Multiply
Read A
Print A=50
Push 10, 2,3 : Multiply : Multiply: Print Number=60
Module Multiply {
If not match("NN") Then Error "I nead two numbers"
Read a, b
Push a*b
}
Call Multiply 10, 5
Print Number=50
\\ now there are two values in stack 20 and 50
Multiply
}
Call Checkit, 20, 50
Print Number=1000