Skip to content

Instantly share code, notes, and snippets.

@andreinechaev
Created April 26, 2015 15:12
Show Gist options
  • Save andreinechaev/d23dc7e5baf216016d40 to your computer and use it in GitHub Desktop.
Save andreinechaev/d23dc7e5baf216016d40 to your computer and use it in GitHub Desktop.
//: Playground - noun: a place where people can play
import UIKit
let days = [1, 2, 3, 4, 5, 6, 7]
for day in days {
switch day {
case 1...5:
println("Weekday")
case 5, 7:
println("Weekend")
default:
println("Not a day")
}
}
let daysAsString = ["Mon", "Tue", "Wed", "Thu", "Fri", "Sat", "Sun"]
for index in 1...daysAsString.count {
switch index {
case 1...5:
println("Weekday")
case 5, 7:
println("Weekend")
default:
println("Not a day")
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment