Project

General

Profile

Bug #11143

it should always be possible to return from an if

Added by bughit (bug hit) over 5 years ago. Updated 9 months ago.

Status:
Closed
Priority:
Normal
Assignee:
-
Target version:
-
[ruby-core:69150]

Description

irb(main):001:0> def foo; a = if true then return end end
SyntaxError: (irb):1: void value expression

it should not matter that you are not producing a value for the if expression, since you are leaving the method immediately. This should also apply to other jumps.


Related issues

Related to Ruby master - Bug #15932: wrong "void value expression" error for 'next' or 'break' statements inside an 'if' assignmentClosedActions

Also available in: Atom PDF