Last active
April 30, 2017 19:00
-
-
Save zidenis/648ac7ea9b3ed11b04a39d6ad45bad90 to your computer and use it in GitHub Desktop.
if-null operator
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// As funções whatLangA, whatLangB e whatLangC implementam a mesma funcionalidade. | |
var language = "Dart"; | |
whatLangA() => language ?? "not Dart"; | |
whatLangB() => language == null ? "not Dart" : language; | |
whatLangC() { | |
if (language==null) return "not Dart"; | |
else return language; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment