Project

General

Profile

Actions

Bug #21808

open

Inconsistency in support of additional newlines with boolean logical operators on new line

Bug #21808: Inconsistency in support of additional newlines with boolean logical operators on new line

Added by herwin (Herwin W) about 21 hours ago. Updated about 21 hours ago.

Status:
Assigned
Target version:
-
ruby -v:
ruby 4.0.0 (2025-12-25 revision 553f1675f3) +PRISM [x86_64-linux]
[ruby-core:124367]

Description

With this I mean the new Ruby 4 feature.

With the old style, one could add additional lines in between:

if true &&

   true
     puts 'match'
end

With the new style, this results in a syntax error

if true

   && true
     puts 'match'
end

If a comment is used instead of a new line, it still works

if true
   # blah
   && true
     puts 'match'
end

This happens with both prism and parse.y

I doubt anyone would want to write code like this (I don't think it improves the layout), but it's still a weird inconsistency that doesn't get mentioned.

Actions

Also available in: PDF Atom