Setting default values (conditional assignment)

后端 未结 5 1899
一生所求
一生所求 2020-12-05 17:26

In Ruby you can easily set a default value for a variable

x ||= \"default\"

The above statement will set the value of x to \"default\" if

5条回答
  •  再見小時候
    2020-12-05 18:15

    I think your longer form is already the shortcut for php... and I wouldn't use it, because it is not good to read

    Some notice: In the symfony framework most of the "get"-Methods have a second parameter to define a default value...

提交回复
热议问题