Dev study and notes

[dart] #15 add print comment #3.0 Defining a Function (04:15) 본문

studyLog

[dart] #15 add print comment #3.0 Defining a Function (04:15)

devlunch4 2023. 5. 2. 05:49
반응형
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));
}

// PRINT
// >>>
// Hello, lunch, Nice to meet you.
// Hello, lunch!!!, Nice to meet you.
// 3
반응형
Comments