본문 바로가기
스터디/Dart

[Dart] #3.0 Functions

by SayHiWorld 2024. 1. 10.
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