Quote from
Gaev on September 4, 2023, 2:32 am
@tilesoft
How can I stop the subroutines?
Am I using "Return"?
Yes
And how?
Try this
a) Setup 2 Input Boxes with variables [Amount] and [Discount]
b) Setup a Button with this code ...
SetVar "[Trace]" "Before calling amountSubroutine"
SetVar "[Trace]" "[Trace]<br/>Discount=[Discount], Amount=[Amount]"
amountSubroutine
SetVar "[Trace]" "[Trace]<br/>Returned from amountSubroutine"
SetVar "[Trace]" "[Trace]<br/>Amount=[Amount]"
AlertBox "Trace" "[Trace]" ""
c) create a subroutine (named amountSubroutine)with this code ...
If [Discount] = 5
Math "[Amount]-5" 0 "[Amount]"
... parameter for Return command is immaterial in this example
Return ""
EndIf
Math "[Amount]-2" 0 "[Amount]"
When you setup [Discount] as 5, it subtracts 5 from [Amount]; otherwise, it subtracts 2
@tilesoft
How can I stop the subroutines?
Am I using "Return"?
Yes
And how?
Try this
a) Setup 2 Input Boxes with variables [Amount] and [Discount]
b) Setup a Button with this code ...
SetVar "[Trace]" "Before calling amountSubroutine"
SetVar "[Trace]" "[Trace]<br/>Discount=[Discount], Amount=[Amount]"
amountSubroutine
SetVar "[Trace]" "[Trace]<br/>Returned from amountSubroutine"
SetVar "[Trace]" "[Trace]<br/>Amount=[Amount]"
AlertBox "Trace" "[Trace]" ""
c) create a subroutine (named amountSubroutine)with this code ...
If [Discount] = 5
Math "[Amount]-5" 0 "[Amount]"
... parameter for Return command is immaterial in this example
Return ""
EndIf
Math "[Amount]-2" 0 "[Amount]"
When you setup [Discount] as 5, it subtracts 5 from [Amount]; otherwise, it subtracts 2
luishp and tilesoft have reacted to this post.