Page 48


Flow Diagram

Example var varA:Int = 100;

/* Check the boolean condition using if statement */ if varA < 20 { /* If condition is true then print the following */ println("varA is less than 20"); } else { /* If condition is false then print the following */ println("varA is not less than 20"); } println("Value of variable varA is \(varA)"); When the above code is compiled and executed, it produces the following result: varA is not less than 20 Value of variable varA is 100

if...else if...else Statement An if statement can be followed by an optional else if...else statement, which is very useful to test various conditions using single if...else if statement. When using if, else if, else statements, there are a few points to keep in mind. 36

​Quick is really a powerful and intuitive programming language for macOS, iOS, watchOS and tvO...  


Read more
Read more
Similar to
Popular now
Just for you