Project

General

Profile

Actions

Feature #14606

open

Change begin-else-end without rescue from warning to syntax error

Added by joker1007 (Tomohiro Hashidate) about 6 years ago. Updated about 6 years ago.

Status:
Open
Assignee:
-
Target version:
-
[ruby-core:86134]

Description

begin
  p :foo
else
  p :bar
end

# => :foo
# => :bar
[1,2,3].each do
  p :foo
else
  p :bar
end

# => :foo
# => :bar

begin-else-end without rescue is useless and dangerous. (especially, do-else-end is easy to mistake)
In actually, programmer never intend to write like these.
Ruby interpreter can guard this case by syntax error.

Actions

Also available in: Atom PDF

Like0
Like0Like0