Answers for "swift 5 if statement"

1

swift 5 if statement

let a = -5

// if the condition is true then doThis() gets called else doThat() gets called
a >= 0 ? doThis(): doThat()

func doThis() {
    println("Do This")
}

func doThat() {
    println("Do That")
}
Posted by: Guest on April-08-2020
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

Code answers related to "Swift"

Browse Popular Code Answers by Language