Shop OBEX P1 Docs P2 Docs Learn Events
If Then — Parallax Forums

If Then

LowtideLowtide Posts: 12
edited 2007-02-24 22:46 in BASIC Stamp
I cut and pasted the following sample code from·syntax guide. When I run it I get an " expected label" message next to the Then. What am I missing?

value·· VAR···· Word

Main:
· DO
··· PULSIN 0, 1, value························· ' measure pulse input
··· DEBUG DEC value, CR
··· IF (value > 4000) THEN····················· ' evaluate duration
····· DEBUG "Value was greater than 4000"
··· ELSEIF (value = 4000) THEN
····· DEBUG "Value was equal to 4000"
··· ELSE
····· DEBUG "Value was less than 4000"
··· ENDIF
··· DEBUG CR, CR
··· PAUSE 1000
· LOOP

Comments

  • Mike GreenMike Green Posts: 23,101
    edited 2007-02-24 22:46
    You will need to specify PBasic version 2.5 since the IF/ELSEIF/ELSE/ENDIF format is not allowed in PBasic version 2.0 which is the default for the PBasic Editor/Compiler. Add a directive like "' {$PBASIC 2.5}" at the beginning of your program. The manual discusses this around page 44.
Sign In or Register to comment.