if statement help.

Posted by David Berthiaume on Sun 19 Feb 2006 09:22 AM — 6 posts, 26,208 views.

#0
Right then I know how to use if and elseif, been using them for years now.

The question is can I do a general if statement(pseudo-code to follow)?
stuff = "%1"
if stuff = (numbers but no characters... I.E. words or letters) then
(do stuff here)
elseif stuff = "ON" then
(do more stuff)
elseif stuff = "OFF" then
(more stuff)
else
(something else)
end if
Basically, I want to be able find out if the wildcard is numeral digits, and not letters.
Amended on Sun 19 Feb 2006 09:23 AM by David Berthiaume
USA #1
You'll have to call some function on the wildcard, that will return true or false accordingly. Such functions typically have names like "is_number", "IsNumber", "IsNumeric", etc.
#2
In the immortal words of the Guiness guys... Brilliant!
#3
I have a tiny question, so I'll reply to this post instead of a making a new thread.

How do I make an:

IF a == b then
(do nothing) -- Is it possible to (do nothing)?
elseif b == c then
Note ("Aha!")
end
USA #4
why not just test for if ( a != b ) and ( b == c ) to get it all in one statement? Some languages will allow you to have empty thens, but it it much more sane looking to just for what you're looking for than to test for what you're not looking for and using an else. The unequals is also varies a lot in different languages. The most popular seem to be != and <>, with Lua using ~=. If an unequals doesn't exist, then you can usually just negate the test with something like not( a == b )
Netherlands #5
How about (assuming Lua):

if (a ~= b) and (b == c) then
    Note("Bingo!")
end


Edit: note to self, reply faster.