mirror of
https://github.com/wren-lang/wren.git
synced 2026-01-11 14:18:42 +01:00
Allow returns without an explicit value.
This commit is contained in:
@ -1 +1,6 @@
|
||||
var a = "ok"; IO.print(a) // expect: ok
|
||||
var f = fn {
|
||||
return "ok"
|
||||
IO.print("bad")
|
||||
}
|
||||
|
||||
IO.print(f.call) // expect: ok
|
||||
|
||||
6
test/return/return_null_if_brace.wren
Normal file
6
test/return/return_null_if_brace.wren
Normal file
@ -0,0 +1,6 @@
|
||||
var f = fn {
|
||||
if (true) { return }
|
||||
IO.print("bad")
|
||||
}
|
||||
|
||||
IO.print(f.call) // expect: null
|
||||
6
test/return/return_null_if_newline.wren
Normal file
6
test/return/return_null_if_newline.wren
Normal file
@ -0,0 +1,6 @@
|
||||
var f = fn {
|
||||
return
|
||||
IO.print("bad")
|
||||
}
|
||||
|
||||
IO.print(f.call) // expect: null
|
||||
Reference in New Issue
Block a user