스터디/Dart

[Dart] #3.0 Functions

SayHiWorld 2024. 1. 10. 16:36
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'));
}