![]() |
PBasic Select Problem
Greetings,
I have chosen to use the new SELECT construct in PBasic. Here is the code fragment: 'Dead Reckoning Code Select stepnum CASE 0 : gosub go_home CASE 1 : gosub go_home2 CASE 2 : if rc_sw3 = UP & rc_sw4 = UP then gosub go_left else gosub go_right CASE 3 : gosub go_forward CASE 4 : if rc_sw3 = UP & rc_sw4 = UP then gosub go_left else gosub go_right CASE 5 : gosub go_longforward ENDSELECT When I check syntax, it always highlights the stepnum variable and provide the following error: Expected ':' or end-of-line Error: 129-Expected ':' or end-of-line What causes this error ? Searched and couldn't find anything. Am running the 2.0 beta 1 editor. It acts like it doesn't understand the new language features. thanks in advance. |
I had that error once when I had forgot to define a variable.
Have you also checked to make sure that you have included the new PBASIC 2.5 definition at the top? Code:
' {$PBASIC 2.5} |
Put that in right below
{$STAMP BS2SX} But It compains about my constant definition: ON con 1 Is ON now a predefined constant ? Tried using the stamp editor help to find this out but its useless. Are the constants ON, OFF, TRUE,FALSE UP,DOWN now predefined ? thanks |
Yes, most likely they're reserved. Instead pick a constant that has more meaning, such as ARM_UP, or LIFT_UP, etc.
You'll also get an error in your code because you didn't close your if conditions with an 'endif' |
I already fixed the missing ENDIF
problem. thanks for the heads up. |
| All times are GMT -5. The time now is 04:26. |
Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.
Copyright © Chief Delphi