Re: If-statement problems

*To*: mathgroup at smc.vnet.net*Subject*: [mg49500] Re: If-statement problems*From*: Jens-Peer Kuska <kuska at informatik.uni-leipzig.de>*Date*: Thu, 22 Jul 2004 02:45:15 -0400 (EDT)*Organization*: Universitaet Leipzig*References*: <cdlj0l$83c$1@smc.vnet.net>*Reply-to*: kuska at informatik.uni-leipzig.de*Sender*: owner-wri-mathgroup at wolfram.com

Hi, a) the if-Test is If[] with a capital I b) {a,b,c,d}=A will do it Regards Jens Aaron Fude wrote: > > Hi, > > New to Mathematica. I can't figure out how to use the if-statement for pure > flow control. > > Here's an example: > > A = {5, 6, 7, 8} > For [n = 1, n <= 4, n++, > if [n == 1, a = A[[n]]]; > if [n == 2, b = A[[n]]]; > if [n == 3, c = A[[n]]]; > if [n == 4, d = A[[n]]]; > ] > > I want to assign to a b c and d the 4 values from A. Obviously, that's not > what happens. How do I accomplish what I need? > > Many thanks in advance!!! > > Aaron Fude