MathGroup Archive 2009

[Date Index] [Thread Index] [Author Index]

Search the Archive

Re: strange behavior


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


  • Prev by Date: Re: strange behavior
  • Next by Date: Re: How to Calculatelength of an Spline curve between two
  • Previous by thread: strange behavior
  • Next by thread: Re: strange behavior