I am trying to create a program that based on your score will give you a certain message. I did it a couple of years back but I dont remember how its bone in basic
example
less than or equal to 500 1 message
greater then 500 but not more than 1000 a different message
greater then 1000 another entierly different message
what do I do?
Help with program
-
- Veteran
- Posts: 109
- Joined: Thu Feb 10, 2005 12:38 pm
this might help:
you probably will want something more complex than just print "Message 1"
=< means equal to and/or lower
=> means equal to and/or higher
> means higher only
< means lower only
Code: Select all
if score =<500 then
print "Message 1"
elseif score =<1000 then
print "Message 2"
elseif score > 1000 then
print "Message 3"
end if
=< means equal to and/or lower
=> means equal to and/or higher
> means higher only
< means lower only
Less than or equal to
I always write "less than or equal to" this way:
Either way works. I just think it looks better than =<.
Code: Select all
if count <= 500 then do stuff
--- Zim ---
--- Time flies like an arrow, but fruit flies like a banana ---
--- Time flies like an arrow, but fruit flies like a banana ---
Case Structure
Oh, and... you can also do it with case structure like this:
Also, if you use a "case" structure that can possibly have a "no case" case, you need to provide a "case else" like this:
I think case structure reads real nice.
Code: Select all
select case score
case is < 500
...do low score stuff
case 500 to 1000
...do medium score stuff
case is > 1000
...do high score stuff
end select
Code: Select all
select case score
case is < 500
...lo score stuff
case 500 to 1000
...do other stuff
case else
...neither of the above was true
end case
--- Zim ---
--- Time flies like an arrow, but fruit flies like a banana ---
--- Time flies like an arrow, but fruit flies like a banana ---
-
- Veteran
- Posts: 109
- Joined: Thu Feb 10, 2005 12:38 pm