Shop OBEX P1 Docs P2 Docs Learn Events
Any way to send variables to a function/proced — Parallax Forums

Any way to send variables to a function/proced

ArchiverArchiver Posts: 46,084
edited 2001-10-02 04:13 in General Discussion
All (BS2) variables are global. You needn't pass a variable to a
GOSUB, all variables are available to all code at all times.
Further, there is always one and only one instance of a variable, so
if you modify it anywhere its new value is available everywhere.
(Since you don't pass variables, the concepts of pass by reference
or pass by value are without meaning for PBasic).

Regards,

Steve

On 1 Oct 01 at 19:46, nospam@e... wrote:

> While the gosub command is great for reusing code, it would be
> WONDERFUL to be able to send variables to them. Does anyone know if
> this can be done? Are variables always global?

Comments

  • ArchiverArchiver Posts: 46,084
    edited 2001-10-02 04:13
    I think he's referring to C like stlye coding. Where
    you can create procedures with arguments and return
    values.





    --- S Parkis <parkiss@e...> wrote:
    > All (BS2) variables are global. You needn't pass a
    > variable to a
    > GOSUB, all variables are available to all code at
    > all times.
    > Further, there is always one and only one instance
    > of a variable, so
    > if you modify it anywhere its new value is available
    > everywhere.
    > (Since you don't pass variables, the concepts of
    > pass by reference
    > or pass by value are without meaning for PBasic).
    >
    > Regards,
    >
    > Steve
    >
    > On 1 Oct 01 at 19:46, nospam@e... wrote:
    >
    > > While the gosub command is great for reusing code,
    > it would be
    > > WONDERFUL to be able to send variables to them.
    > Does anyone know if
    > > this can be done? Are variables always global?
    >
    > To UNSUBSCRIBE, just send mail to:
    > basicstamps-unsubscribe@yahoogroups.com
    > from the same email address that you subscribed.
    > Text in the Subject and Body of the message will be
    > ignored.
    >
    >
    > Your use of Yahoo! Groups is subject to
    > http://docs.yahoo.com/info/terms/
    >
    >


    __________________________________________________
    Do You Yahoo!?
    Listen to your Yahoo! Mail messages from any phone.
    http://phone.yahoo.com
Sign In or Register to comment.