Day 3 – Operators and Conditions

[cc_swift width=”100%” height=”100%”] let age1 = 12 let age2 = 21 if age1 > 18 && age2 > 18 { print(“Both are over 18.”) } if age1 > 18 || age2 > 18 { print(“One of them is over 18.”) } // ternary operator let firstCard = 10 let secondCard = 11 print(firstCard == secondCard ? “cards same!” : “cards different”) let score = 89 switch score { case 0..<50: print("Low!") case 50...100: print("High!") default: print("default value") } [/cc_swift]

Leave a Reply

Your email address will not be published. Required fields are marked *