Any way to send variables to a function/proced
Archiver
Posts: 46,084
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?
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
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