| Author |
Comment/Response |
Bill Simpson
|
12/19/12 10:36pm
In Response To 'Re: While-Loop inside Module doesn't work' --------- The result returned from Module[] is going to be the last expression inside the Module.
In your example the last expression is While[] and that returns Null.
If you want to have the result from your faculty function to be u then you should have
faculty[x_]:=Module[
...
While[
...
];
u
];
faculty[3]
You can try it with and without that added u and verify this for yourself.
It is generally a bad idea to not separate every pair of expressions with a semicolon. Sometimes you can get away without this, but not including semicolons has been a source of puzzling errors for many years.
URL: , |
|