Skip to content

Instantly share code, notes, and snippets.

@edopelawi
Created August 30, 2016 14:00
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save edopelawi/0b750417f0fc436a50b78410f5fcb432 to your computer and use it in GitHub Desktop.
Save edopelawi/0b750417f0fc436a50b78410f5fcb432 to your computer and use it in GitHub Desktop.
A sample on using force-unwrap against an String optional.
name = "Ol' Man Jenkins"
// This call will work, since it has a valid value.
print(createGreetings(sailorName: name!))
name = nil
// This call will cause an error, since `name` has no value at this point.
print(createGreetings(sailorName: name!))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment