Project

General

Profile

Actions

Bug #20094

closed

Inline while loop behavior changed unexpectedly in 3.3.0

Added by sisyphus_cg (Sisyphus CG) 7 months ago. Updated about 2 months ago.

Status:
Closed
Assignee:
-
Target version:
-
[ruby-core:115923]

Description

The behavior of the inline while loop has changed in 3.3.0. This unexpectedly broke my code and I couldn't find anything in the changelog about it so reporting it as a bug.

In ruby <= 3.2:

(p 1) while false      # nothing
(p 1; p 2) while false # nothing

In ruby 3.3:

(p 1) while false      # 1
(p 1; p 2) while false # 1 2

Essentially, if the left hand side looks like a statement, now it is treated as a do-while loop. In ruby 3.2 and less this only happened with explicit use of begin and end.

Actions

Also available in: Atom PDF

Like0
Like1Like0Like0Like0Like0Like0Like0Like0Like0Like0Like1Like1