Answers for "swift if else one line"

1

one line if statement swift

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

Code answers related to "Swift"

Browse Popular Code Answers by Language