Skip to content

Instantly share code, notes, and snippets.

@masters3d
Created March 9, 2015 03:30
Show Gist options
  • Save masters3d/206296e6dbd3e39328ca to your computer and use it in GitHub Desktop.
Save masters3d/206296e6dbd3e39328ca to your computer and use it in GitHub Desktop.
extension Array{
func indexInbound (index: Int) -> Bool{
if 0 <= index && index < count {
return true
} else {
return false
}
}
}
let b = a.indexInbound(2) ? a[2] : -1
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment