Re: boolean affectation shortcut

fr 13:

You can’ t because only methods can end with ?

i think he is asking, why not? of course, we know it is not currently
possible, but variable names with “?” may enhance readability.


x? = method_that_determines_some_status

if x?


by just looking at the name, we are pretty sure that x? is a boolean
(just like is_xx? methods return bools).

wc is better than,

if x


whether x is a variable or method…

it’s just an added character where one may happily use or not. But maybe
i am missing something deeper…

kind regards -botp

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs