Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR SWIFT

Swift if..else if

// check whether a number is positive, negative, or 0.

let number = 0

if (number > 0) {
    print("Number is positive.")
}

else if (number < 0) {
    print("Number is negative")
}

else {
    print("Number is 0.")
}

print("This statement is always executed")
 
PREVIOUS NEXT
Tagged: #Swift
ADD COMMENT
Topic
Name
5+5 =