Alice Community

Alice Community (http://www.alice.org/community/index.php)
-   How do I...? (http://www.alice.org/community/forumdisplay.php?f=16)
-   -   Returning Values from an If statement (http://www.alice.org/community/showthread.php?t=7386)

rondoran 10-13-2011 04:24 AM

Returning Values from an If statement
 
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:D

godzac 10-13-2011 10:44 AM

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

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

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

Else
If.. and so on.

Both [B]underage[/B] and [B]legal to gamble in Vegas[/B] are variables (string).


Hope this helps ;)

rondoran 10-14-2011 06:16 PM

THanks yes it does


All times are GMT -5. The time now is 11:28 PM.

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