Project

General

Profile

Actions

Bug #21608

closed

三項演算子と break を組み合わせると SyntaxError

Added by ursm (Keita Urashima) about 19 hours ago. Updated about 14 hours ago.

Status:
Rejected
Assignee:
Target version:
-
ruby -v:
ruby 3.4.6 (2025-09-16 revision dbd83256b1) +PRISM [x86_64-linux]
[ruby-dev:<unknown>]

Description

>> RUBY_VERSION
=> "3.4.5"
>> [1, 2].find {|i| i.even? ? break i : nil }
>> RUBY_VERSION
=> "3.4.6"
>> [1, 2].find {|i| i.even? ? break i : nil }
<internal:kernel>:168:in 'Kernel#loop': (irb):2: syntax error found (SyntaxError)
> 2 | ... i : nil }
    |     ^ unexpected local variable or method, expecting end-of-input

	from /home/ursm/.local/share/mise/installs/ruby/3.4.6/lib/ruby/gems/3.4.0/gems/irb-1.15.2/exe/irb:9:in '<top (required)>'
	from /home/ursm/.local/share/mise/installs/ruby/3.4.6/bin/irb:25:in 'Kernel#load'
	from /home/ursm/.local/share/mise/installs/ruby/3.4.6/bin/irb:25:in '<main>'
Actions

Also available in: Atom PDF

Like0
Like0Like0Like0Like0