void V_sayHello(String name){ //void means this funtion doesn't return anything
print("hello $name nice to meet you");
}
String S_sayHello(String name){
return "hello $name nice to meet you";
}
String S2_sayHello(String name) => "hello $name nice to meet you"
//fat arrow syntax. immediate return. use when your function only has one line code.
//don't have to use Curly Brakets
void main() {
print(S_sayHello('nico'));
}
'스터디 > Dart' 카테고리의 다른 글
[Dart] #3.2 Recap ^_^ (positional,named,required,default) (0) | 2024.01.10 |
---|---|
[Dart] #3.1 Named Parameters ({ }) (0) | 2024.01.10 |
[Dart] #2.5 Sets (0) | 2024.01.10 |
[Dart] #2.4 Maps (1) | 2024.01.10 |
[Dart] #2.3 Collection For (0) | 2024.01.10 |