func originalStyleLongComplimentAboutBlog(blog: iOSDevelopmentBlog) {
if let blogName = blog.name {
print("The \(blogName) blog is a great iOS Development Blog!")
if let blogAuthor = blog.Author {
print("It is written by \(blogAuthor).")
if let blogURL = blog.URL {
print("Visit it at \(blogURL)")
} else {
print("Search for it on your favorite on your favorite search engine.")
}
} else {
print("it is written by an unknown author.")
}
} else {
print("I don't know the name of this blog, but it's a good one!")
}
}
func guardStyleLongComplimentAboutBlog(blog: iOSDevelopmentBlog) {
guard let blogName = blog.name else {
print("I don't know the name of this blog, but it's a good one!")
return
}
print("The \(blogName) blog is a great iOS Development Blog!")
guard let blogAuthor = blog.Author else {
print("it is written by an unknown author.")
return
}
print("It is written by \(blogAuthor).")
guard let blogURL = blog.URL else {
print("Search for it on your favorite on your favorite search engine.")
return
}
print("Visit it at \(blogURL)")
}
let maybeNumbers: [Int?] = [3, 7, nil, 12, 40]
for maybeValue in maybeNumbers {
guard let value = maybeValue else {
print("No Value")
break
}
print(value)
}