Data Sheet
dScript
dScript User Manual v2.15
dScript commands
goto
goto is used to transfer program execution to another point in the program. The target of a
goto command is always a label.
Example:
goto label1
gosub
gosub is used to call subroutines. The address of the next instruction following the gosub is
stored on the stack, control is then transferred to the subroutine. A return command at the
end of the subroutine then transfers control back to the instruction following the gosub
command.
Example:
gosub IncA ; call the subroutine IncA
... ; return here
...
goto somewhere
IncA: A = A + 1 ; perform the task
return ; return to instruction following the gosub
return
return is used at the end of a subroutine. It pops the return address off the stack and transfers
control to that address.
if - single statement execution
The "if" command is used to make a decision on what to do next. The simplest form of the if
command to conditionally execute a single instruction.
if <condition> statement.
This most commonly would be a goto instruction.
if A > B goto BigA
however any single instruction may be executed.
This simple form of the if command does not require endif and cannot use else to provide an
alternative operation.
Copyright © 2016, Devantech Ltd.
All rights reserved.
www.robot-electronics.co.uk
24