Block v. Module
- To: mathgroup at smc.vnet.net
- Subject: [mg68175] Block v. Module
- From: Bruce Colletti <vze269bv at verizon.net>
- Date: Thu, 27 Jul 2006 05:29:55 -0400 (EDT)
- Sender: owner-wri-mathgroup at wolfram.com
Re Mathematica 5.2.0.0. The Module and Block below "should" return the same result, but they don't. The Module's result makes no sense, while the Block's result is what I want. What's Module doing? The way I read the Help Text, both should return the same result. Thankx. Bruce f[Y_String]:=Module[{x},x=StringReplace[Y,{x_->x}]]; x={"yes","no"}; f@"xyz" {yes,no}~~{yes,no}~~{yes,no} f[Y_String]:=Block[{x},x=StringReplace[Y,{x_->x}]]; x={"yes","no"}; f@"xyz" Out[3]= xyz