Difference between sc_set_global([var]) and sc_set_global($var) ??

I have seen this written two different ways to write a global variable to the session (not to mention the third ._$SESSION method)

I am wondering what the difference is between these two:


$my_var = {my_field01};
sc_set_global($my_var);


$my_var = {my_field01};
sc_set_global([my_var]);

They both seem to work, but without more debug info it’s hard to tell if there is any benefit or drawback to one or the other.
For example,
Does the first left-square-bracket in “sc_set_global([” … instruct the parser that a variable is to be processed …
-OR Does the dollar-sign in “sc_set_global($” … instruct the parser that the variable is noted and no square-brackets are needed?

I’m confused as to why it can be done 2 different ways but they both seem to serve the same purpose. (but only while “setting” the variable)

It seems like “sc_set_global([my_var])” (according to programming logic) would require that [my_var] is already set, since the use of the square-bracket enclosure usually means to ScriptCase that it should read an existing variable.

Did I miss something? – Which method is proper/correct?

Re: Difference between sc_set_global([var]) and sc_set_global($var) ??

This is my understanding:

$my_var = local to function
[my_var] = global to app

$my_var = {my_field01};
sc_set_global($my_var) or sc_set_global([my_var]) = global to app; same thing just allowing you to accessing a local or global var. 2nd seems redundant except to reassign?

$_SESSION[‘my_var’] = global to session: all apps

Regards,
Scott.