Bypasses the usual flow of control and passes control to the statement prefixed by a specified label.
goto label
| Variable | Description |
|---|---|
| label | A label name, a valid 4Test identifier. |
4Test interprets any valid identifier followed by a colon as a label. You can put a label anywhere in the code for a function.
[-] testcase goto_example()
[ ] INTEGER i = 1
[-] while(TRUE)
[-] if(i > 3)
[ ] goto Done
[ ] Print(i)
[ ] i = i + 1
[-] Done:
[ ] Print("All done")
[ ] // This script prints:
[ ] // 1
[ ] // 2
[ ] // 3
[ ] // All done