Check out example codes for "one line if statement swift". It will help you in understanding the concepts better.

Code Example 1

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")

Learn ReactJs, React Native from