Search

ν•¨μˆ˜

ν•¨μˆ˜

ν•¨μˆ˜ μ •μ˜

νƒ€μž… λ©”μ†Œλ“œλͺ… ( λ§€κ°œλ³€μˆ˜1, λ§€κ°œλ³€μˆ˜2 ) { }
Dart
볡사
β€’
μ˜ˆμ‹œ μ½”λ“œ
int add(int a, int b) { return a + b; } void main() { print(add(3, 5)); // 좜λ ₯: 8 }
Dart
볡사

읡λͺ… ν•¨μˆ˜

읡λͺ… ν•¨μˆ˜

( νƒ€μž… λ§€κ°œλ³€μˆ˜1, νƒ€μž… λ§€κ°œλ³€μˆ˜2 ) { }
Dart
볡사
β€’
μ˜ˆμ‹œμ½”λ“œ
var multiply = (int a, int b) { return a * b; }; void main() { print(multiply(3, 5)); // 좜λ ₯: 15 }
Dart
볡사

λžŒλ‹€ ν•¨μˆ˜

λžŒλ‹€ ν•¨μˆ˜ μ •μ˜

(νƒ€μž… λ§€κ°œλ³€μˆ˜1, νƒ€μž… λ§€κ°œλ³€μˆ˜2) => λ°˜ν™˜κ°’;
Dart
볡사
(νƒ€μž… λ§€κ°œλ³€μˆ˜1, νƒ€μž… λ§€κ°œλ³€μˆ˜2) => { μ‹€ν–‰λ¬Έ }
Dart
볡사
(νƒ€μž… λ§€κ°œλ³€μˆ˜1, νƒ€μž… λ§€κ°œλ³€μˆ˜2) => { return λ°˜ν™˜κ°’; }
Dart
볡사
β€’
μ˜ˆμ‹œ μ½”λ“œ
var multiply = (int a, int b) => a * b; void main() { print(multiply(3, 5)); // 좜λ ₯: 15 }
Dart
볡사
μž¬κ·€ ν•¨μˆ˜
ν•¨μˆ˜ 자기 μžμ‹ μ„ ν˜ΈμΆœν•˜λŠ” ν•¨μˆ˜
int factorial(int n) { if (n == 0 || n == 1) { return 1; } else { return n * factorial(n - 1); } } void main() { print(factorial(5)); // 좜λ ₯: 120 }
Dart
볡사