Case Statements in Atom Basic?

Just to clarify, there is no SELECT/CASE command in Atom or AtomPro basic. I always felt it was covered by if/elseif/elseif/elseif just as well.

[code]if gaitCode = $00 then ’ depending on gaitCode
’ Adjust Legs if 0 is selected
ptrEEPROM = Adjust
rightRamp = Fast
leftRamp = Fast
GOTO Walking_Engine

elseif gaitCode = $01
ptrEEPROM = LTurn ’ Spin left
rightRamp = VeryFast ’ Assign ramp to
leftRamp = VeryFast ’ left and right sides
GOTO Walking_Engine

elseif gaitCode = $02
ptrEEPROM = RTurn ’ Spin right
rightRamp = VeryFast
leftRamp = VeryFast
GOTO Walking_Engine
endif[/code]

If a Select/Case is ever added it will generate the same tokens as the above example that mimics the code posted by KM6VV

Also note that a Select/Case command is much more limited. It expects a simple comparison match where an If/ElseIf/Endif allows complex comparison(eg if gaitcode&SomeBitMask then or even if something and somethingelse or someotherthing then) which are not supported by Select/Case.

The if-elseif construct can certainly do the job. And as Acidtech has observed, it would generate the same code.

Blame me for looking for “old shoes”. ‘C’ is my first language, and the constructs are very comfortable. Other languages make me thing a little more.

So I guess curly brackets are out of the question? ;>)

'---- [Gait Selection] --------------------------------------------------- Parse_GaitCode: ' Assign gait parameters SELECT gaitCode ' depending on gaitCode CASE $00 ' Adjust Legs if 0 is selected ptrEEPROM = Adjust rightRamp = Fast leftRamp = Fast GOTO Walking_Engine CASE $01 ptrEEPROM = LTurn ' Spin left rightRamp = VeryFast ' Assign ramp to leftRamp = VeryFast ' left and right sides GOTO Walking_Engine CASE $02 ptrEEPROM = RTurn ' Spin right rightRamp = VeryFast leftRamp = VeryFast GOTO Walking_Engine ENDSELECT

been a while now but i think i can remember this being used for the STAMP BS2!