User Tools

Site Tools


el:global

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

el:global [2016/01/01 22:39]
el:global [2020/02/28 10:46] (current)
Line 1: Line 1:
 +===== Global =====
  
 +==== Format ====
 +**global** //variable list//\\
 +
 +==== Description ====
 +
 +Global will define a list of one or more (comma separated) variables that will be accessible and changeable within [[subroutine|Subroutine]]s and [[Function|Function]]s.  These variables can be simple variables, or array variables.
 +
 +Global variables can only be defined outside of any block statement and should be defined BEFORE you call a [[Function|Function]] or [[subroutine|Subroutine]].
 +
 +==== Example ====
 +
 +<code>
 +global a, name$
 +dim a(10)
 +dim name$(10)
 +a = {1,4,6,8,45,34,76,98,43,12}
 +name$ = {"Bob","Sue","Sam","Jim","Luis","Guido","Steve","Angela","Joe","Paul"
 +t = 99
 +call printnames()
 +print t + " was unchanged - not global"
 +end
 +
 +subroutine printnames()
 +  for t = 0 to name$[?] -1
 +    print a[t] + " " + name$[t]
 +  next t
 +end subroutine
 +</code>
 +displays\\
 +<code>
 +1 Bob
 +4 Sue
 +6 Sam
 +8 Jim
 +45 Luis
 +34 Guido
 +76 Steve
 +98 Angela
 +43 Joe
 +12 Paul
 +99 was unchanged - not global
 +</code>
 +==== See Also ====
 +{{page>en:start#Program Control&noheader}}
 +
 +==== New To Version ==== 
 +0.9.9.1
el/global.txt ยท Last modified: 2020/02/28 10:46 (external edit)