Shop OBEX P1 Docs P2 Docs Learn Events
Clearing multiple variable instances — Parallax Forums

Clearing multiple variable instances

rcm14rcm14 Posts: 11
edited 2012-04-21 10:59 in Propeller 1
If I setup multiple instances of a variable in the VAR block, can I clear all the instances at once?

Essentially my question is this: Would the following code work?
VAR[INDENT]long symbol[30]
[/INDENT]

PUB Main
[INDENT]
'Would the line below clear each instance of the variable "symbol"
symbol~
...
...[/INDENT]

Any help would be greatly appreciated.

Comments

  • Phil Pilgrim (PhiPi)Phil Pilgrim (PhiPi) Posts: 23,514
    edited 2012-04-21 01:01
    No. You have to do it in each instance of the object that declares the variable. VAR variable "instances" are per-object. Is that what you meant when you used the word "instances"?

    -Phil
  • Duane DegnDuane Degn Posts: 10,588
    edited 2012-04-21 10:14
    My attempt at ESP says this is what rcm14 wants to do.
    longfill(@symbol, 0, 30)
    

    Global variables start out zero.
  • Phil Pilgrim (PhiPi)Phil Pilgrim (PhiPi) Posts: 23,514
    edited 2012-04-21 10:59
    Duane,

    I'll bet you're right. "Instance", in this case means "element" (of the array).

    -Phil
Sign In or Register to comment.