| 1 | fn C.func(arg i32) i32 |
| 2 | |
| 3 | fn fn_variadic(arg int, args ...string) { |
| 4 | println('Do nothing') |
| 5 | } |
| 6 | |
| 7 | fn fn_with_assign_stmts() { |
| 8 | _, _ := fn_with_multi_return() |
| 9 | } |
| 10 | |
| 11 | fn fn_with_multi_return() (int, string) { |
| 12 | return 0, 'test' |
| 13 | } |
| 14 | |
| 15 | fn voidfn() { |
| 16 | println('this is a function that does not return anything') |
| 17 | } |
| 18 | |
| 19 | fn fn_with_1_arg(arg int) int { |
| 20 | return 0 |
| 21 | } |
| 22 | |
| 23 | fn fn_with_2a_args(arg1 int, arg2 int) int { |
| 24 | return 0 |
| 25 | } |
| 26 | |
| 27 | fn fn_with_2_args_to_be_shorten(arg1 int, arg2 int) int { |
| 28 | return 0 |
| 29 | } |
| 30 | |
| 31 | fn fn_with_2b_args(arg1 string, arg2 int) int { |
| 32 | return 0 |
| 33 | } |
| 34 | |
| 35 | fn fn_with_3_args(arg1 string, arg2 int, arg3 User) int { |
| 36 | return 0 |
| 37 | } |
| 38 | |
| 39 | fn (this User) fn_with_receiver() { |
| 40 | println('') |
| 41 | } |
| 42 | |
| 43 | fn fn_with_option() ?int { |
| 44 | if true { |
| 45 | return error('true') |
| 46 | } |
| 47 | return 30 |
| 48 | } |
| 49 | |
| 50 | fn (f Foo) fn_with_option() ?int { |
| 51 | if true { |
| 52 | return error('true') |
| 53 | } |
| 54 | return 40 |
| 55 | } |
| 56 | |
| 57 | fn mut_array(mut a []int) { |
| 58 | println(1) |
| 59 | } |
| 60 | |
| 61 | fn fn_with_ref_return() &Foo { |
| 62 | return &Foo{} |
| 63 | } |
| 64 | |
| 65 | @[inline] |
| 66 | fn fn_with_flag() { |
| 67 | println('flag') |
| 68 | } |
| 69 | |