Project

General

Profile

Actions

Bug #14700

closed

Endless ranges don't seem to work properly with case statements

Added by shan (Shannon Skipper) over 6 years ago. Updated over 6 years ago.

Status:
Rejected
Assignee:
-
Target version:
-
ruby -v:
ruby 2.6.0dev (2018-04-20 trunk 63199) [x86_64-darwin17]
[ruby-core:86619]

Description

I'm running into an unexpected error with this code

case 1
when 0..
end
#!> SyntaxError: unexpected keyword_end, expecting keyword_then or ',' or ';' or '\n'

Thanks!

Updated by mame (Yusuke Endoh) over 6 years ago

  • Status changed from Open to Rejected

Please use parentheses, like when (0..). Unfortunately, it is difficult to allow this because it may cause a conflict with existing programs.

x = 1
case x
when 0..
  3
  p "#{ x } is in 0..3"
end
Actions

Also available in: Atom PDF

Like0
Like0