Created
June 27, 2013 06:10
-
-
Save itang/5874318 to your computer and use it in GitHub Desktop.
dart short style method
This file contains 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
void main() { | |
print(f0()); // -> sss | |
print(f1()); // -> null | |
print(f2()); // -> sss | |
print(f3()); // -> yyy | |
var len = "dasada".split("").where((c) => c == 'a').length; | |
print("LEN:$len"); //-> 3 | |
} | |
String f0(){ return "sss"; } | |
String f1(){ "sss"; } | |
String f2() => "sss"; | |
String f3() => false? "sss" : "yyy"; | |
//String f4() =>{return "sss"}; //syntax error |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment