| 1 | module main |
| 2 | |
| 3 | type Cmd = fn () string |
| 4 | |
| 5 | fn cplx() (bool, ?Cmd) { |
| 6 | return true, stringer |
| 7 | } |
| 8 | |
| 9 | fn stringer() string { |
| 10 | return 'a string' |
| 11 | } |
| 12 | |
| 13 | fn test_main() { |
| 14 | mut cmd := ?Cmd(none) |
| 15 | mut truth := false |
| 16 | truth, cmd = cplx() |
| 17 | if cmd != none { |
| 18 | println(cmd()) |
| 19 | assert true |
| 20 | } else { |
| 21 | assert false |
| 22 | } |
| 23 | } |
| 24 |