Answers for "swift if else syntax"

0

swift if statement

// check the number is positive or negative
let num = 15
var result = ""

if (num > 0) {
     result = "Positive Number"
}
else {
     result = "Negative Number"
}

print(result)
Posted by: Guest on May-08-2021
0

swift else if

if (condition1) {
    // code block 1
}

else if (condition2){
    // code block 2
}

else {
    // code block 3
}
Posted by: Guest on June-12-2021

Code answers related to "Swift"

Browse Popular Code Answers by Language