Answers for "swift else if"

3

if statement swfit

// if expression {
// 	do something
// }

var a: Int = 3
if a == 3 {
	print("Hello World")
} else if a < 3 {
	print("dlroW olleH")
} else {
	print("42")
}
Posted by: Guest on March-14-2020
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
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

Code answers related to "Swift"

Browse Popular Code Answers by Language