PDA

View Full Version : Using BREAK



eduardomorais
11-23-2010, 12:45 AM
Hello everybody!

Could someone answer me how I could make a BREAK, if given the chance, in SPIN?
I'm needing to use a CASE, but encounter problems by putting the BREAK between the cases.

Duane Degn
11-23-2010, 02:46 AM
I'm not sure what you mean. Can you give an example?

If you post code as an example remember to use the # symbol to so you code keeps its format.

Duane

jazzed
11-23-2010, 03:16 AM
Could someone answer me how I could make a BREAK, if given the chance, in SPIN?
I'm needing to use a CASE, but encounter problems by putting the BREAK between the cases.
There is no BREAK in SPIN. CASE is simple.



PUB isAlpha(char)
case char
"a".."z","A".."Z":
result := true
other:
result := false

Mike Green
11-23-2010, 03:25 AM
If you're used to C's SWITCH statement, Spin's CASE statement is more like Pascal's. There's an implied BREAK for every case.

eduardomorais
11-23-2010, 12:04 PM
Thank you!:smilewinkgrin:

I got knowledge could understand how it works.