mirror of
https://github.com/vlang/v.git
synced 2023-08-10 21:13:21 +03:00
test high order function
This commit is contained in:
@@ -115,6 +115,21 @@ fn high_fn_multi_return(a int, b fn (c []int, d []string) ([]int, []string)) {
|
||||
|
||||
}
|
||||
|
||||
fn sqr(x int) int {
|
||||
return x * x
|
||||
}
|
||||
|
||||
fn test_fns() {
|
||||
// no asserts for now, just test function declarations above
|
||||
high_fn(sqr)
|
||||
}
|
||||
|
||||
|
||||
fn test_anon_fn() {
|
||||
/*
|
||||
high_fn(fn (x int) int {
|
||||
println('hello')
|
||||
return x + 1
|
||||
})
|
||||
*/
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user