Shop OBEX P1 Docs P2 Docs Learn Events
PBASIC Structural Question — Parallax Forums

PBASIC Structural Question

buzzmanbuzzman Posts: 2
edited 2012-02-08 08:56 in BASIC Stamp
Noob question about PBASIC structure.

In BASIC one can create a Sub routine and pass it parameters.
Likewise, one can create a function, pass it parameters and have it return a value.
Is this construct available in PBASIC?
I see nothing in the big book.

Thanks!

Comments

  • Martin_HMartin_H Posts: 4,051
    edited 2012-02-08 08:44
    PBasic supports a gosub and return, but all variables are global. Given the memory constrained environment of the Basic Stamp local variables are not practical. I've used the scratch pad in the BS2e as a stack for a limited number of variables, but that isn't available on all stamps. For return values I usually establish a global variable for this purpose.
  • buzzmanbuzzman Posts: 2
    edited 2012-02-08 08:56
    OK thanks. That's where I was headed. Thanks for the help.
Sign In or Register to comment.