select case fall-through

Discussion of issues related to writing ZBasic applications for targets other than ZX devices, i.e. generic targets.
Post Reply
stevech
Posts: 715
Joined: 22 February 2006, 20:56 PM

select case fall-through

Post by stevech »

there's no "break" statement in ZBasic, but is there any way to fall-through the code in one case clause into the next? I have a habit of doing that in finite state machines.
Other than a goto or repeating code from the successive state, I don't see a way.

As an ole C programmer, I'm putting

Code: Select all

' exit case
at the bottom of case clauses. Makes me nervous leaving it dangling.
dkinzer
Site Admin
Posts: 3120
Joined: 03 September 2005, 13:53 PM
Location: Portland, OR

Re: select case fall-through

Post by dkinzer »

stevech wrote:is there any way to fall-through the code in one case clause into the next?
Other than using goto, no. That's just the way that Select/Case is designed in VisualBasic. Interestingly, a commom criticism of C/C++ is that case code falls through unless you explicitly add a break to prevent it.
- Don Kinzer
Post Reply