From: from-ruby-lang@... Date: 2019-06-17T09:27:37+00:00 Subject: [ruby-core:93199] [Ruby trunk Bug#15932] wrong "void value expression" error for 'next' or 'break' statements inside an 'if' assignment Issue #15932 has been reported by cvss (Cyril Vechera). ---------------------------------------- Bug #15932: wrong "void value expression" error for 'next' or 'break' statements inside an 'if' assignment https://bugs.ruby-lang.org/issues/15932 * Author: cvss (Cyril Vechera) * Status: Open * Priority: Normal * Assignee: * Target version: * ruby -v: 1.8.7 .. 2.7.0preview1 * Backport: 2.4: UNKNOWN, 2.5: UNKNOWN, 2.6: UNKNOWN ---------------------------------------- When a 'next' or 'break' statement for block/loop control is placed inside an 'if' assignment, the parser outputs an error "void value expression". The same parsing error raises for the ternary operator in the same conditions. I think, the the correct behavior should be consistent with the behavior of the 'case' statement, that is parsing such a code without errors and leaving the right-side variable with 'nil' value. Examples of code giving a "void value expression" error: 1. ``` begin a = if false 'A' else next end end while false ``` 2. ``` begin a = false ? 'A' : next end while false ``` Example of code running without errors: 3. ``` begin a = case false when true 'A' else next end end while false ``` 4. ``` begin a = (false or next) end while false ``` -- https://bugs.ruby-lang.org/ Unsubscribe: