Skip to content

Instantly share code, notes, and snippets.

@rizumita
Created January 30, 2018 19:38
Show Gist options
  • Save rizumita/ae3d48c2c647f8c88b27155d816c9e57 to your computer and use it in GitHub Desktop.
Save rizumita/ae3d48c2c647f8c88b27155d816c9e57 to your computer and use it in GitHub Desktop.
var i: Character?
test("Optional Binding") {
for _ in 0...repeatCount {
if let us = s {
i = us.first
} else {
i = "i".first
}
}
}
print(String(describing: i))
var j: Character?
test("??") {
for _ in 0...repeatCount {
j = (s ?? "j").first
}
}
print(String(describing: j))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment