Dev study and notes

[dart] #14 #3.0 Defining a Function (04:15) 본문

studyLog

[dart] #14 #3.0 Defining a Function (04:15)

devlunch4 2023. 5. 2. 05:48
반응형
String sayHello(String name) {
    return "Hello, $name, Nice to meet you.";
}

// fat arrow sysntax ex1
String sayHelloFAS(String name) => "Hello, $name, Nice to meet you.";

// fat arrow sysntax ex2
num add(num a, num b) => a + b;

void main() {
    print(sayHello("lunch"));
    print(sayHelloFAS("lunch!!!"));
    print(add(1, 2));
}
반응형
Comments