switch statements swift
var x = 1
switch x {
case 0: // if x = 0
print("x = 0")
case 1: // if x = 1
print("x = 1")
default: // if x is not 0 nor 1
print("no x value")
}for i in 1 ... 100 {
switch (i % 3, i % 5) {
case (0, 0):
print("FizzBuzz")
case (0, _):
print("Fizz")
case (_, 0):
print("Buzz")
default:
print(i)
}
}
Also in Swift:
- switch statements swift
- hide bottom tab bar swift
- swift set uicolor
- get device height spritekit
- Get the length of a String swift
- show alert swiftui
- swift filter array
- swift ternary statement
- swift temporary directory
- how to screen record swift stackoverflow
- how to swift pie chart quartzcore framework
- how to show notification icon on tabbar item swift
- swift writing to ios logs
- give background color swiftui
- swift from 1 to 01
- swift uitableview cell spacing
- change selection color uitableviewcell swift
- swift sort array
- how to dismiss a view when touch up inside swift
- get item filter count swift
- swift declare optional values
- limit log file size swift
- convert string to int swift
- register for remote notifications swift