Alice Community  

Go Back   Alice Community > Alice 2 > How do I...?

Reply
 
Thread Tools Display Modes
Returning Values from an If statement
Old
rondoran
Junior Member
 
Status: Offline
Posts: 5
Join Date: Sep 2011
Location: Werribee
Wink Returning Values from an If statement - 10-13-2011, 04:24 AM

I have an assignment that requires me to return a value if it meets certain conditions,
The conditions are as follows
If number between 1 and 16
Object to say the number and add some text
else
If number between 16 and 18
Object to say namber and add some text

and it goes on for 7 statements
The problems arises is that I can return the 1st number but if the value is greater than the 1st number nothing is returned so my nested If is not functioning.
Any help appreciated
Cheers
Ron
   
Reply With Quote
Heh
Old
godzac
Junior Member
 
Status: Offline
Posts: 1
Join Date: Sep 2011
Default Heh - 10-13-2011, 10:44 AM

There's no need for any "betweens". You have to use a whole lot of If / Else statements.

For example,
If age < 16, say This person is classified as joined with underage

Else
If age < 21, say This person is classified as joined with legal to gamble in Vegas

Else
If.. and so on.

Both underage and legal to gamble in Vegas are variables (string).


Hope this helps

Last edited by godzac; 10-13-2011 at 12:36 PM.
   
Reply With Quote
Old
rondoran
Junior Member
 
Status: Offline
Posts: 5
Join Date: Sep 2011
Location: Werribee
Default 10-14-2011, 06:16 PM

THanks yes it does
   
Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump



Copyright ©2017, Carnegie Mellon University
Alice 2.x 1999-2012, Alice 3.x 2008-2012, Carnegie Mellon University. All rights reserved.