Created
October 11, 2011 16:20
-
-
Save ryuone/1278570 to your computer and use it in GitHub Desktop.
dart sample
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
| main(){ | |
| var xxx = {'one':1, "two":2}; // key must be string. | |
| print(xxx["one"]); // NG : xxx.one | |
| print(xxx['two']); | |
| var a,b=100; | |
| final f = 20; | |
| print(a); | |
| print(b); | |
| // f = 100; // error | |
| twice(var n) => n * 2; | |
| twice2(var n){ | |
| n * 2; | |
| } | |
| print(twice2(12)); | |
| for(int i=0,imax=5;i<imax;i++){ | |
| print("i = ${i}"); | |
| } | |
| final greet_world = (String greeting) => | |
| print(greeting + ', world!'); | |
| greet_world('Hi.'); | |
| final make_add_n = (int n) => (int m) => m + n; | |
| var _make_add_n = make_add_n(1); | |
| print(_make_add_n); | |
| print(_make_add_n(10)); | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment