{VERSION 4 0 "IBM INTEL NT" "4.0" } {USTYLETAB {CSTYLE "Maple Input" -1 0 "Courier" 0 1 255 0 0 1 0 1 0 0 1 0 0 0 0 1 }{CSTYLE "2D Math" -1 2 "Times" 0 1 0 0 0 0 0 0 2 0 0 0 0 0 0 1 }{CSTYLE "Hyperlink" -1 17 "" 0 1 0 128 128 1 0 0 1 0 0 0 0 0 0 1 }{CSTYLE "2D Output" 2 20 "" 0 1 0 0 255 1 0 0 0 0 0 0 0 0 0 1 } {CSTYLE "" 0 21 "" 0 1 0 0 0 1 0 0 0 0 2 0 0 0 0 1 }{CSTYLE "Help Head ing" -1 26 "" 1 14 0 0 0 0 0 1 0 0 0 0 0 0 0 1 }{PSTYLE "Normal" -1 0 1 {CSTYLE "" -1 -1 "" 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 1 }0 0 0 -1 -1 -1 0 0 0 0 0 0 -1 0 }{PSTYLE "Text Output" -1 2 1 {CSTYLE "" -1 -1 "Couri er" 1 10 0 0 255 1 0 0 0 0 0 1 3 0 0 1 }1 0 0 -1 -1 -1 0 0 0 0 0 0 -1 0 }{PSTYLE "Heading 1" 0 3 1 {CSTYLE "" -1 -1 "" 1 18 0 0 0 0 0 1 0 0 0 0 0 0 0 1 }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 1 }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 1 }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 51 " \+ ... is implicitly declared local to procedure ..." }}{PARA 0 "" 0 "" {TEXT -1 281 "Maple provides this warning when you define a function u sing a variable which you do not declare as local or global, but which Maple assumes is local. Maple makes this assumption for any undeclar ed variable that is assigned a value in the procedure, or is the index variable in a " }{MPLTEXT 0 21 3 "for" }{TEXT -1 94 " loop. Any othe r undeclared variable 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 ign ore the warning. It is generally a good idea for index variables in \+ " }{MPLTEXT 0 21 3 "for" }{TEXT -1 461 " loops to be local, because yo u usually don't need or want to refer to these variables outside the l oop. However, in some cases you do want the variable to be global. I n particular, a common situation would be where you use a procedure to set the values of some global variables. Or you may want to have acc ess to the values of some variables from another procedure which this \+ one calls, without using a formal parameter. In these cases, you shou ld use the " }{MPLTEXT 0 21 6 "global" }{TEXT -1 42 " declaration to m ake the variables global." }}}{SECT 0 {PARA 3 "" 0 "" {TEXT 26 9 "Exam ples:" }}{PARA 0 "" 0 "" {TEXT -1 13 "The variable " }{MPLTEXT 0 21 1 "y" }{TEXT -1 84 " is assigned a value in the following procedure, and therefore is taken to be local." }}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 26 "foo:= proc(x) y:= x+1 end;" }}{PARA 7 "" 1 "" {TEXT -1 61 "War ning, `y` is implicitly declared local to procedure `foo`\n" }}{PARA 11 "" 1 "" {XPPMATH 20 "6#>%$fooGR6#%\"xG6#%\"yG6\"F*>8$,&9$\"\"\"F/F/ F*F*F*" }}}{PARA 0 "" 0 "" {TEXT -1 70 "Since it is local, the procedu re 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 assign a value to " }{MPLTEXT 0 21 1 "y" }{TEXT -1 42 ", that variable should be declared global." }} {EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 36 "foo:= proc(x) global y; y:= \+ x+1 end;" }}{PARA 11 "" 1 "" {XPPMATH 20 "6#>%$fooGR6#%\"xG6\"F(F(>%\" yG,&9$\"\"\"F-F-F(6#F*F(" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 10 "foo(3): y;" }}{PARA 11 "" 1 "" {XPPMATH 20 "6#\"\"%" }}}{PARA 0 "" 0 "" {TEXT -1 50 "In the next 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#>%\"aGR6#%\"xG6\"F(F(C%>%\"yG\"\"\"-% \"bG6#9$F+F(6#F+F(" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 36 "b:= p roc(x) global y; y:= y + x end;" }}{PARA 11 "" 1 "" {XPPMATH 20 "6#>% \"bGR6#%\"xG6\"F(F(>%\"yG,&F*\"\"\"9$F,F(6#F*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 in 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(`Hello`,j) od end;" }} {PARA 7 "" 1 "" {TEXT -1 61 "Warning, `j` is implicitly declared local to procedure `foo`\n" }}{PARA 11 "" 1 "" {XPPMATH 20 "6#>%$fooGR6#%\" xG6#%\"jG6\"F*?(8$\"\"\"F-9$%%trueG-%&printG6$%&HelloGF,F*F*F*" }}}} {SECT 0 {PARA 0 "" 0 "" {TEXT 26 9 "See also:" }{TEXT -1 1 " " } {HYPERLNK 17 "procedure" 2 "procedure" "" }{TEXT -1 2 ", " }{TEXT -1 0 "" }{HYPERLNK 17 "for" 2 "do" "" }}}{SECT 0 {PARA 0 "" 0 "" {TEXT 26 22 "Maple Advisor Database" }{TEXT -1 18 " R. Israel, 2000" }}} {PARA 0 "" 0 "" {TEXT -1 0 "" }}}{MARK "3 0 1" 18 }{VIEWOPTS 1 1 0 1 1 1803 1 1 1 1 }{PAGENUMBERS 0 1 2 33 1 1 }