MathGroup Archive 2004

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

Search the Archive

Re: If-statement problems

  • To: mathgroup at smc.vnet.net
  • Subject: [mg49527] Re: [mg49472] If-statement problems
  • From: DrBob <drbob at bigfoot.com>
  • Date: Thu, 22 Jul 2004 02:47:00 -0400 (EDT)
  • References: <200407211039.GAA07824@smc.vnet.net>
  • Reply-to: drbob at bigfoot.com
  • Sender: owner-wri-mathgroup at wolfram.com

I almost forgot the simple answer (which works if all four symbols are undefined):

{a,b,c,d}={5,6,7,8}

or

A = {5, 6, 7, 8}
{a,b,c,d}=A

Bobby

On Wed, 21 Jul 2004 06:39:52 -0400 (EDT), Aaron Fude <aaronfude at yahoo.com> 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
>
>
>
>



-- 
DrBob at bigfoot.com
www.eclecticdreams.net


  • Prev by Date: Re: Plotting a contour plot with cylindrical co-ordinates
  • Next by Date: RE: simple problem with Map?!?
  • Previous by thread: If-statement problems
  • Next by thread: Re: If-statement problems