----- RECURSION -----
(num int)
| 277 | |
| 278 | // ----- RECURSION ----- |
| 279 | func factorial(num int) int { |
| 280 | // This condition ends calling functions |
| 281 | if num == 0 { |
| 282 | return 1 |
| 283 | } |
| 284 | return num * factorial(num-1) |
| 285 | } |
| 286 | |
| 287 | // When a Go program executes it executes a function named main |
| 288 | // Go statements don't require semicolons |