Define Class Test As Session Function Test1 x = 1 ? x ? This.Test2() EndFunc Function Test2 Return x && x is private so no error here EndFunc EndDefineNew Sys() Option
ox = CreateObject("Test") =ox.Test1() Define Class Test As Session Protected Function Init() =Sys(9999, 1) && New sys function EndFunc Function Test1 x = 1 ? x ? This.Test2() EndFunc Function Test2 Return x && x an error here, x is local to test1() EndFunc EndDefine>>VFP supports block scoop, the block is the whole function.
FOR I = 1 TO 10 > LOCAL N && N has procedure scope although it was declared within a block. > N = I >ENDFOR > >W = 10 ^ N && N is still visible outside the block it is declared in>With code block:
FOR I = 1 TO 10 > { > LOCAL N && N has block scope > N = I > } >ENDFOR > >W = 10 ^ N && Error: N is not visible outside the block it is declared in>