Forum Rules Notice

Due to inappropriate SPAM postings, our forums are now being monitored for inappropriate content. This will cause your post to not appear publicly until it has been approved by a forum moderator. We apologize for the delay this may cause in your response, but have found it the best way to control inappropriate posts.

  Reply to this topicStart new topicStart Poll

> More Info On How To Use If Statements / Conditional Statements
Posted: Jan 3 2010, 04:00 PM

I don't have enough information on how to use the If statement. I'm not even certain that's the function I want to use in this program.

What I have is a variable that I've defined to cover a certain range of integers. I want to say:

"If the variable is even, then return the sentence "[Sentence1]." Otherwise, return the sentence "[Sentence2]."

More specifically, I was trying to use the mod function when I got stuck: "If Mod2 of the variable is 0, say one thing. If it isn't, say another thing."
PMEmail Poster
Posted: Jan 8 2010, 11:04 PM

Try this.

define a variable:
num = range(-5,5,1) { if you do not want zero} or
num = range(-5,5) if you want to allow zero

and a variable:
phrase = if (num/2 = int(num/2),"even number -- put sentence 1 here", "odd number -- put sentence 2 here")

PMEmail Poster
1 User(s) are reading this topic (1 Guests and 0 Anonymous Users)
0 Members:

Reply to this topic Start new topicStart Poll


Copyright 1998-2008 eInstruction Corp. All rights reserved.