Re: strange behavior
- To: mathgroup at smc.vnet.net
- Subject: [mg104825] Re: [mg104787] strange behavior
- From: DrMajorBob <btreat1 at austin.rr.com>
- Date: Wed, 11 Nov 2009 04:26:09 -0500 (EST)
- References: <200911101058.FAA19606@smc.vnet.net>
- Reply-to: drmajorbob at yahoo.com
Because you left out a colon in the second version, of course! In that one, ans = InputString[whatever] * Null, since Null is the value of Print. Bobby On Tue, 10 Nov 2009 04:58:05 -0600, Jason Winters <Jason_member at nntpjunkie.com> wrote: > Hi! I am wondering why these two modules behave differently > > > Module[{ans = ""}, > For[i = 1, i < 10, i++, > ans = InputString["Enter a String"]; > Print[ans] > ] > ] > > > and > > > Module[{ans = ""}, > For[i = 1, i < 10, i++, > ans = InputString["Enter a String"] > Print[ans] > ] > ] > > > One prints out a bunch of extraneous Null's > > Also is there anyway to type variable in Mathematica i.e. declare i to > be and > integer or string or whatever. > > > Thanks for any help you can give. > Sorry for the simpleness of these questions. > > Thanks > > -- DrMajorBob at yahoo.com
- References:
- strange behavior
- From: Jason Winters <Jason_member@nntpjunkie.com>
- strange behavior