Skip to content

Instantly share code, notes, and snippets.

@PhilippeBoisney
Last active September 3, 2015 14:32
Show Gist options
  • Save PhilippeBoisney/7e117d8eaad31132c89a to your computer and use it in GitHub Desktop.
Save PhilippeBoisney/7e117d8eaad31132c89a to your computer and use it in GitHub Desktop.
/**
Le "Optionnal Chaining" permet d'effectuer une action,
uniquement si la variable à l'origine de l'action n'est pas égale à nil.
*/
result = retourneParfoisNil(true) //result égale 10
print(result?.getMirror()) // result égale "Optional(Swift._LeafMirror<Swift.Int>(_value: 10, summaryFunction: (Function), quickLookFunction: (Function)))"
result = retourneParfoisNil(false) // result égale nil
print(result?.getMirror()) // result égale nil
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment