Services & Resources / Wolfram Forums
-----
 /
MathGroup Archive
2005
*January
*February
*March
*April
*May
*June
*July
*August
*September
*October
*November
*December
*Archive Index
*Ask about this page
*Print this page
*Give us feedback
*Sign up for the Wolfram Insider

MathGroup Archive 2005

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

Search the Archive

multiple choice IF condition

  • To: mathgroup at smc.vnet.net
  • Subject: [mg56427] multiple choice IF condition
  • From: marloo3 at mail15.com
  • Date: Mon, 25 Apr 2005 01:30:41 -0400 (EDT)
  • Sender: owner-wri-mathgroup at wolfram.com

could we have a more practical way than this way of choosing some numbers of the 
choice:

a = 0;
Table[If[i == 3 || i == 5 || i == 9 || i==18, a = a + i], {i, 20}]

ie: i wish if it is possible like this:
If[i==3 ||5 ||9||18, ...]

Thanks very much
mark


  • Prev by Date: Eigensystem Eigenvalues fail for 34x34 sparse matric but not for 33x33
  • Next by Date: Problem with MatchQ and SameQ
  • Previous by thread: Re: Eigensystem Eigenvalues fail for 34x34 sparse matric but not for 33x33
  • Next by thread: Re: multiple choice IF condition