if then, else statements are a very important part of AppleScripting or any programming for that matter. The statement is relatively simple to construct and are about the only way to compare variables. Say you want to determine if you need a coat for today; depending on the temperature you could make the decision. If the temperature is lower than 50 degrees, you should probably take a coat. Let’s take a look at a simple pseudocode that describes this situation.
The temperature is 67. if the temperature is lower than 50 degrees
You should wear a coat
else
You'll be fine without a coat. end if
Here is how the statement would look with the variables declared.
This simple applescript can be modified to use ranges rather than a set temperature. For instance, if the temperature is between -200 and 50 degrees and 51 and 200 degrees. The lower and upper range is set to an extreme [at least for IL] so that nothing could be left out.

0 Responses to “if then, else, end if”