Information générale
Catégorie:
Codage, syntaxe et commandes
In your sample: MyVar is private in LowerProc. But, because by default params are passed by reference to procedures (by value to functions), MyVar will be changed at the calling level. So, the params passing method is responsible for the change and not the scope of params. The MyVar variable will not change if:
public MyVar, Myvar1
Myvar = 12
MyVar1 = 20
do lowerproc with MyVar1
In this case, at the calling level, MyVar will not change, MyVar1 will change.
BTW, I will never understand why params are passed by reference to procs and by value to functions. Why this difference? Can anyone give a good reason?
Vlad
>I wonder if PARAMETERS is just enough to make a variable PRIVATE to only one PROC.
>
>public myvar
>myvar = 12
>
>do lowerproc with myvar
>do anotherproc
>
>
>proc lowerproc
>PARAMETERS myvar
>myvar = 25
>
>proc anotherproc
>? myvar
>
>Cetin
Précédent
Suivant
Répondre
Voir le fil de ce thread
Voir le fil de ce thread à partir de ce message seulement
Voir tous les messages de ce thread
Voir tous les messages de ce thread à partir de ce message seulement