Skip to content

Commit

Permalink
Add Open-sided ranges.
Browse files Browse the repository at this point in the history
  • Loading branch information
sunnykarira committed Aug 6, 2017
1 parent aedbd28 commit 94503ff
Showing 1 changed file with 21 additions and 0 deletions.
Expand Up @@ -88,6 +88,27 @@ for i in 0..<count {
print("Person \(i + 1) is called \(names[i])")
}

// One-Sided ranges
for name in names[2...] {
print(name)
}
// Brian
// Jack

for name in names[...2] {
print(name)
}
// Anna
// Alex
// Brian

for name in names[..<2] {
print(name)
}
// Anna
// Alex


// Logical Operators
let allowedEntry = false
if !allowedEntry {
Expand Down

0 comments on commit 94503ff

Please sign in to comment.