Why should you avoid the then keyword in Ruby?

后端 未结 3 348
甜味超标
甜味超标 2021-01-18 00:42

It\'s mentioned in several Ruby style guides that you should \"Never use then.\" Personally, I think the \"then\" keyword allows you to make code denser, which tends to be

3条回答
  •  被撕碎了的回忆
    2021-01-18 01:22

    I think "never use then" is wrong. Using too much non-alphabet characters can make code as difficult to read as perl or APL. Using a natural language word often makes the programmer more comfortable. It depends on the balance between readability and compactness of the code. Ternary operator is occasionally convinient, but is ugly if misused.

提交回复
热议问题