Question : if else if and else statments in swift language
Answered by : muhammad-zeeshan-vdbiet6jzy1z
var action: String
var person = "hater"
if person == "hater" { action = "hate"
} else if person == "player" { action = "play"
} else { action = "cruise"
}
Source : https://www.hackingwithswift.com/read/0/8/conditional-statements | Last Update : Thu, 03 Mar 22
Question : Swift if..else if
Answered by : samer-saeid
// check whether a number is positive, negative, or 0.
let number = 0
if (number > 0) { print("Number is positive.")
}
else if (number < 0) { print("Number is negative")
}
else { print("Number is 0.")
}
print("This statement is always executed")
Source : | Last Update : Wed, 22 Jun 22
Question : Swift if...else Statement
Answered by : samer-saeid
if (condition) { // block of code if condition is true
}
else { // block of code if condition is false
}
Source : | Last Update : Mon, 20 Jun 22