Mathematica 9 is now available
Student Support Forum
Student Support Forum > General > > "While-Loop inside Module doesn't work"

Post Reply:
Email Address:

Please send email when my message is replied to.

Url (optional):
Message: view original message?
Attachment (optional):
Please answer this:2+2 =

Original Message (ID '176585') By xavier:
I found one mistake: product had to be termed inside the brackets at the beginning of the Module-segment. faculty[x_] := Module [{u;product}, product = 1; u = 1; While[u <= x, product = product*u; u = u + 1 ](*While*) ](*Module*) faculty[3] Now I get the following output: Module::lvsym: Local variable specification {u;product} contains u;product, which is not a symbol or an assignment to a symbol. >> So I think the While-Loop is not the big problem. But I don't understand why Mathematica tells me that u is not a symbol (and product also not). Can anyone help? Thank you very much! Xavier