Shop OBEX P1 Docs P2 Docs Learn Events
Need help with "while" error ... — Parallax Forums

Need help with "while" error ...

jmlpropjmlprop Posts: 9
edited 2007-02-04 20:57 in Propeller 1
Hello,
I am getting a "while"·error when running the following code on page 118 of the prop manual. Any help would be appreciated. The exact error is
"expected an instruction or varible".

CON
· _CLKMODE = RCSLOW

VAR
· LONG STACK[noparse][[/noparse]9]
· Byte Cog

PUB Start(Pin, Delay, Count): Success
Stop
Success := (Cog := cognew(Toggle(Pin, Delay, Count), @Stack + 1))

PUB Stop
· if Cog
··· cogstop(Cog~ - 1)

PUB Active: YesNo
· YesNo := Cog > 0
··
PUB· Toggle(Pin, Delay, Count)
·· dira[noparse][[/noparse]Pin]~~
·· repeat
··· !outa[noparse][[/noparse]Pin]
··· waitcnt(Delay + Count)
· while Count := - -Count #> -1
· Cog~·

Comments

  • CJCJ Posts: 470
    edited 2007-02-04 20:36
    while is used with repeat on the same line,

    repeat while condition

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Who says you have to have knowledge to use it?

    I've killed a fly with my bare mind.
  • Paul BakerPaul Baker Posts: 6,351
    edited 2007-02-04 20:38
    Remove the space between the two - symbols, these should be continuous --. And as CJ has mentioned make sure blocks of code are indented properly.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Paul Baker
    Propeller Applications Engineer

    Parallax, Inc.
  • jmlpropjmlprop Posts: 9
    edited 2007-02-04 20:57
    Thanks guys, that did it ... I just indented while one space further and it cleared up.
Sign In or Register to comment.