Wait

Wait
Program execution is stopped by a **Wait** statement. **Wait** does not work the way it has done in Liberty BASIC 4.

Syntax: WAIT - Stop and wait for an event. This discards the stack of nested function and subroutine calls and their state.


 * Carl Gundel tells us, "Once you hit a WAIT statement the execution scope jumps back to the highest level."**

This is very different and changes the way you must handle program flow if you are used to coding in Liberty BASIC 4.x. The following small program demonstrates how **Wait** works in Run BASIC.

code format="vbnet" print "About to call a sub containing wait."

call MySub 'this line isn't executed 'because WAIT is issued in sub print "Back from sub." wait

sub MySub wait 'the following line isn't executed print "Inside Sub" end sub code Carl adds: WAIT isn't exactly as in Liberty BASIC. This is partly because of a technical issue dealing with state and the Seaside framework, and partly because I realized that the way Liberty BASIC does things is very unorthodox and I was under the impression (perhaps wrongly) that only a very experienced LBer takes advantage of the way that WAIT works in subs and functions. For most use cases, WAIT in RB does work the way it does in LB. I've never seen another language that does things the way LB does, so I figured (perhaps again wrongly) that it wouldn't be missed in RB. Add to it that I didn't feel able to invest the time to figure this out. Maybe in a future release I'll manage to support the full LB WAIT behavior in RB.