Answers for "swift conditional statement on single 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 conditional statement on single line"

Code answers related to "Swift"

Browse Popular Code Answers by Language