{VERSION 2 3 "IBM INTEL NT" "2.3" } {USTYLETAB {CSTYLE "Maple Input" -1 0 "Courier" 0 1 255 0 0 1 0 1 0 0 1 0 0 0 0 }{CSTYLE "2D Math" -1 2 "Times" 0 1 0 0 0 0 0 0 2 0 0 0 0 0 0 }{CSTYLE "Hyperlink" -1 17 "" 0 1 0 128 128 1 0 0 1 0 0 0 0 0 0 } {CSTYLE "2D Output" 2 20 "" 0 1 0 0 255 1 0 0 0 0 0 0 0 0 0 }{CSTYLE " " 0 21 "" 0 1 0 0 0 1 0 0 0 0 2 0 0 0 0 }{CSTYLE "Help Heading" -1 26 "" 1 14 0 0 0 0 0 1 0 0 0 0 0 0 0 }{PSTYLE "Normal" -1 0 1 {CSTYLE "" -1 -1 "" 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 }0 0 0 -1 -1 -1 0 0 0 0 0 0 -1 0 }{PSTYLE "Text Output" -1 2 1 {CSTYLE "" -1 -1 "Courier" 1 10 0 0 255 1 0 0 0 0 0 1 3 0 0 }1 0 0 -1 -1 -1 0 0 0 0 0 0 -1 0 }{PSTYLE "Hea ding 1" 0 3 1 {CSTYLE "" -1 -1 "" 1 18 0 0 0 0 0 1 0 0 0 0 0 0 0 }1 0 0 0 6 6 0 0 0 0 0 0 -1 0 }{PSTYLE "Warning" 2 7 1 {CSTYLE "" -1 -1 "" 0 1 0 0 255 1 0 0 0 0 0 0 1 0 0 }0 0 0 -1 -1 -1 0 0 0 0 0 0 -1 0 } {PSTYLE "Maple Output" 0 11 1 {CSTYLE "" -1 -1 "" 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 }3 3 0 -1 -1 -1 0 0 0 0 0 0 -1 0 }} {SECT 0 {SECT 0 {PARA 0 "" 0 "" {TEXT 26 8 "Warning:" }{TEXT -1 34 " \+ ... is implicitly declared local" }}{PARA 0 "" 0 "" {TEXT -1 281 "Mapl e provides this warning when you define a function using a variable wh ich you do not declare as local or global, but which Maple assumes is \+ local. Maple makes this assumption for any undeclared variable that i s assigned a value in the procedure, or is the index variable in a " } {MPLTEXT 0 21 3 "for" }{TEXT -1 94 " loop. Any other undeclared varia ble is assumed to be global, and no warning is given for it." }}{PARA 0 "" 0 "" {TEXT -1 0 "" }}{PARA 0 "" 0 "" {TEXT -1 134 "If you have no objection to the variable being local, you can ignore the warning. I t is generally a good idea for index variables in " }{MPLTEXT 0 21 3 " for" }{TEXT -1 461 " loops to be local, because you usually don't need or want to refer to these variables outside the loop. However, in so me cases you do want the variable to be global. In particular, a comm on situation would be where you use a procedure to set the values of s ome global variables. Or you may want to have access to the values of some variables from another procedure which this one calls, without u sing a formal parameter. In these cases, you should use the " } {MPLTEXT 0 21 6 "global" }{TEXT -1 42 " declaration to make the variab les global." }}}{SECT 0 {PARA 3 "" 0 "" {TEXT 26 9 "Examples:" }} {PARA 0 "" 0 "" {TEXT -1 13 "The variable " }{MPLTEXT 0 21 1 "y" } {TEXT -1 74 " is assigned a value in the procedure, and therefore is t aken to be local." }}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 26 "foo:= p roc(x) y:= x+1 end;" }}{PARA 7 "" 1 "" {TEXT -1 41 "Warning, `y` is im plicitly declared local" }}{PARA 11 "" 1 "" {XPPMATH 20 "6#>%$fooG:6#% \"xG6#%\"yG6\"F*>8$,&9$\"\"\"F/F/F*F*" }}}{PARA 0 "" 0 "" {TEXT -1 70 "Since it is local, the procedure has no effect on the global variable " }{MPLTEXT 0 21 1 "y" }{TEXT -1 1 ":" }}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 10 "foo(3): y;" }}{PARA 11 "" 1 "" {XPPMATH 20 "6#%\"yG" }}}{PARA 0 "" 0 "" {TEXT -1 52 "If the procedure is to be used to assi gn a value to " }{MPLTEXT 0 21 1 "y" }{TEXT -1 42 ", that variable sho uld be declared global." }}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 36 "f oo:= proc(x) global y; y:= x+1 end;" }}{PARA 11 "" 1 "" {XPPMATH 20 "6 #>%$fooG:6#%\"xG6\"F(F(>%\"yG,&9$\"\"\"F-F-F(6#F*" }}}{EXCHG {PARA 0 " > " 0 "" {MPLTEXT 1 0 10 "foo(3): y;" }}{PARA 11 "" 1 "" {XPPMATH 20 " 6#\"\"%" }}}{PARA 0 "" 0 "" {TEXT -1 46 "In this example, in order for both procedures " }{MPLTEXT 0 21 1 "a" }{TEXT -1 5 " and " }{MPLTEXT 0 21 1 "b" }{TEXT -1 28 " to have access to variable " }{MPLTEXT 0 21 1 "y" }{TEXT -1 50 " (without passing that name as a formal parameter) " }{TEXT -1 48 ", it must be declared global in both procedures." }} {EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 41 "a:= proc(x) global y; y:= 1; b(x); y end;" }}{PARA 11 "" 1 "" {XPPMATH 20 "6#>%\"aG:6#%\"xG6\"F(F( C%>%\"yG\"\"\"-%\"bG6#9$F+F(6#F+" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 36 "b:= proc(x) global y; y:= y + x end;" }}{PARA 11 "" 1 "" {XPPMATH 20 "6#>%\"bG:6#%\"xG6\"F(F(>%\"yG,&F*\"\"\"9$F,F(6#F*" } }}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 5 "a(3);" }}{PARA 11 "" 1 "" {XPPMATH 20 "6#\"\"%" }}}{PARA 0 "" 0 "" {TEXT -1 20 "Index variable i n a " }{MPLTEXT 0 21 3 "for" }{TEXT -1 6 " loop:" }}{EXCHG {PARA 0 "> \+ " 0 "" {MPLTEXT 1 0 59 "foo:= proc(x) for j from 1 to x do print(`Hell o`,j) od end;" }}{PARA 7 "" 1 "" {TEXT -1 41 "Warning, `j` is implicit ly declared local" }}{PARA 11 "" 1 "" {XPPMATH 20 "6#>%$fooG:6#%\"xG6# %\"jG6\"F*?(8$\"\"\"F-9$%%trueG-%&printG6$%&HelloGF,F*F*" }}}}{SECT 0 {PARA 0 "" 0 "" {TEXT 26 9 "See also:" }{TEXT -1 1 " " }{HYPERLNK 17 " procedure" 2 "procedure" "" }{TEXT -1 2 ", " }{HYPERLNK 17 "for" 2 "do " "" }{TEXT -1 2 ", " }{HYPERLNK 17 "Local procedures don't access loc al variables" 2 "Local_procedures_don't_access_local_variables" "" }}} {SECT 0 {PARA 0 "" 0 "" {TEXT 26 22 "Maple Advisor Database" }{TEXT -1 18 " R. Israel, 1997" }}}{PARA 0 "" 0 "" {TEXT -1 0 "" }}}{MARK " 0" 0 }{VIEWOPTS 1 1 0 1 1 1803 }