User blog:IAmAPersson/SimpleC tutorial part 3

Hello there guys. Its time again for another tutorial, and today I'll be teaching you only 1 command, but it it really complex (even moreso than RAND). If you've ever done anything big in SmileBASIC then you should be very familiar with IF...THEN[...ELSE] statements. In SimpleC, its a WHEN...DO[...ELSE] statement, and the syntax is: or if you wanted to add ELSE: Thats simple enough. Whats hard is the syntax of (condition). There are 3 things I can do: test if two strings are the same, test two variables' relationships to each other, or test for a button. To test for two strings to be the same: where A is string 1 and B is string 2. Of course, like all other strings, I can use crazy stuff like ╘. To test two variables (where X is variable 1 and Y is variable 2): There are 3 ways I can compare variables. Using a = means that I'm testing to see if they're the same. If I use a > then I'm testing to see if the first variable is greater than the second, and using a < tests to see if the first variable is less than the second. So, for example, to test if G is less than A: Tada! Now for buttons. You remember when I taught you about the SLP command that you can sleep until a button was pressed? If you forgot, its like this: To test for a button with a WHEN statement: So to test for the up button: to test for the A button: Now to learn about ELSE. ELSE is used when you want an either/or statement. One thats like, "If this condition then do this, if not that condition, do this." It's simple. Lets say that if variables X and Y are the same then it will say "yes" and if they are different it will say "no": Tada! Its actually not that hard when you think about it. Lets make an example program. In this, it will ask for a button press. If you are pressing it, then it will act one way, and if not, it will get mad at you: Thats it for today!