Scoping question
- To: mathgroup at smc.vnet.net
- Subject: [mg85677] Scoping question
- From: Yaroslav Bulatov <yaroslavvb at gmail.com>
- Date: Tue, 19 Feb 2008 01:54:28 -0500 (EST)
The code below defines a function with parameter x. The body contains another function definition which uses this parameter. Why do "inner x is" and "outer x is" lines start reporting different values at one point? f1[x_] := ( f2[y_] := (Print["inner x is ", x]; If[x + 1 < 3, f1[x + 1], 1]); (Print["outer x is ", x]; f2[#]) & /@ Range[2]; ) f1[1]
- Follow-Ups:
- Re: Scoping question
- From: Sseziwa Mukasa <mukasa@jeol.com>
- Re: Scoping question