Xbasic

global_variables Function

Syntax

as P = global_variables()

Description

Gets the global variable frame.

Discussion

The global_variables() function returns a pointer to the collection of global variables.

images/Variable_Scope.gif

Example 

The following example shows all currently defined global variables.

dim g as P
dim list as C
dim to_show as C
' get a pointer to the global variables
g = global_variables()
' build a CR-LF delimited list
list = variables_enum(g)
' build a list that contains variable name, type, and value
to_show = *for_each(var, var + "|" + typeof( eval(var) ) + "|" + eval(var), list)
' show the list
ui_msg_box("global variables",to_show)

shows the global variables, both those generated by Alpha Sports application and by the programmer.

dim global x as C
dim ptr as P
ptr = global_variables()
? ptr
= begin_date = {01/01/1980}
end_date = {12/30/1999}
x = ""
? ptr.end_date -> {12/30/1999}

Limitations

Desktop applications only.

See Also