Difference - unless / if

后端 未结 5 1118
无人共我
无人共我 2020-12-04 20:02

Can anyone explain me the difference between if and unless and when to use it?

5条回答
  •  甜味超标
    2020-12-04 20:21

    Using 'unless' is straightforward to me when there is one argument, but I find it confusing when there are several. And when using || instead of &&.

    "Unless this or that" is just harder for my brain. "if not this and not that" is easier.

    It's going to be harder to maintain this code in the future if I use it. So I don't.

提交回复
热议问题