Jun 04

Applescript If Then – An Example of Using Control Statements in Applescript

Applescript If Then statements are used as control statements i.e. some piece of code will run only in case if applescriptcertain conditions are met. Each if statement works as Boolean value that is used to evaluate a particular expression as either true or false. The commands which are written in the  if statement block, they are executed only if the Boolean returns the true value. If statements ends with an end if.

if  amountReceived < 1000 then

set memberStatus to “General”

else

set memberStatus to “Special”

end ifif else applescript

In the above piece of code, if the Boolean returns true (the amountReceived is less than 1000) then the instructions inside the if statement are executed. And if the Boolean returns false, then those instructions are not executed. In that case, the control is shifted to the else portion and the instructions of else statement will be executed. This combination is known as an if-then-else statement.

In the end, Applescript If Then else is easy to learn. However, practicing it by yourself makes you more clear not only about the control statements but also about development of varying programming skills in your own self.

VN:F [1.9.17_1161]
Rating: 0.0/10 (0 votes cast)
VN:F [1.9.17_1161]
Rating: 0 (from 0 votes)
Related Posts Plugin for WordPress, Blogger...