Printable Version of Topic
Click here to view this topic in its original format
Main > ExamView Dynamic Content and Algorithms > More Info On How To Use If Statements / Conditional Statements

Posted by: Mathos 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."

Posted by: McGarrett 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")

© FSCreations, Inc. (