1
0
mirror of https://github.com/vlang/v.git synced 2023-08-10 21:13:21 +03:00
v/vlib/v/fmt/tests/functions_expected.vv
2020-05-06 12:43:46 +02:00

69 lines
954 B
V

fn C.func(arg int) int
fn fn_variadic(arg int, args ...string) {
println('Do nothing')
}
fn fn_with_assign_stmts() {
_, _ := fn_with_multi_return()
}
fn fn_with_multi_return() (int, string) {
return 0, 'test'
}
fn voidfn() {
println('this is a function that does not return anything')
}
fn fn_with_1_arg(arg int) int {
return 0
}
fn fn_with_2a_args(arg1, arg2 int) int {
return 0
}
fn fn_with_2_args_to_be_shorten(arg1, arg2 int) int {
return 0
}
fn fn_with_2b_args(arg1 string, arg2 int) int {
return 0
}
fn fn_with_3_args(arg1 string, arg2 int, arg3 User) int {
return 0
}
fn (this User) fn_with_receiver() {
println('')
}
fn fn_with_optional() ?int {
if true {
return error('true')
}
return 30
}
fn (f Foo) fn_with_optional() ?int {
if true {
return error('true')
}
return 40
}
fn mut_array(mut a []int) {
println(1)
}
fn fn_with_ref_return() &Foo {
return &Foo{}
}
[inline]
fn fn_with_flag() {
println('flag')
}