As, you can see, we are back to our simple square.But what if we want to something ONLY if a certain condition is met. For example, we want a bigger square, but if the user draws a square big enough, we do not want to tell him to draw an even bigger square. Therefore, we added the IF command that says that IF the variable :A is smaller than 10, to PRINT (This is a new command, it serves to print something out on the command line) "Please, select a bigger number". If the IF condition is not fullfilled the IF command will be skipped and the next thing in the program will be executed. This doesn't happen with the IFELSE command, because the command itself has a true and a false option; IF one condition is not fullfilled, the other one (the ELSE condicition) will be executed. This is an example of the IFELSE command:
As you can see, this is quite similar to the IF command. IF the number is equal to 0, the program will say "Select another number". Otherwise (The ELSE part of IFELSE) the program will say:Good job, you selected a good number..
So, this pretty much wraps it up for our FMSLogo journey for the time being! These aren't nearly all of the commands in FMSLogo, but I am working hard to provide you frequent and user-friendly updates! (I am terribly sorry for the possible typos, mistakes or anything similar that may occur on this webpage..)
As in almost any other programming language, there is an IF, as well as an IFELSE command. So, let's get started, shall we? The IF command does a certain action if a certain condition is fullfilled, and here is an example(ignore the program name):