Project

General

Profile

Feature #12519

Updated by nobu (Nobuyoshi Nakada) almost 8 years ago

Hi all. 

 I propose a syntax change to allow the below to be valid ruby. 

 ```ruby 
 variable `variable = 1 if false else 2 
 ``` 2` 

 This is an extension of the current `modifier_if` modifier_if below which accomplishes the same result. 

 ```ruby 
 variable `variable = 1 if false 
 variable = 2 if !false 
 ``` !false` 

 keeping up with the other condition-statement keyword the below should be valid as well. 

 ```ruby 
 variable `variable = 1 unless true else 2 
 ``` 2` 

 And is an extension of  

 ```ruby 
 variable  
 `variable = 1 unless true 
 variable = 2 unless !true 
 ``` !true` 

 While it's true that ternary syntax accomplishes the same task, I feel that the proposed changes are both more readable and a more natural extension of the language.

Back