Project

General

Profile

Actions

Bug #11143

closed

it should always be possible to return from an if

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

Status:
Closed
Assignee:
-
Target version:
-
ruby -v:
[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 1 (0 open1 closed)

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

Also available in: Atom PDF

Like0
Like0Like0Like0Like0Like0Like0Like0Like0Like0Like0Like0Like0