官术网_书友最值得收藏!

if and unless

These two constructs can be used with the following syntax:

if <expression> do
# expression was truthy
else
# expression was falsy
end

unless <expression> do
# expression was falsy
else
# expression was truthy
end

As with the def construct, they can be inlined. For if, you'd do this:

if <expression>, do: # expression was truthy, else: # expression was falsy 

For both constructs, the else clause is optional. They will return nil if the main clause doesn't match and no else clause was provided.

主站蜘蛛池模板: 禄劝| 西平县| 长阳| 吴江市| 武平县| 兴山县| 新津县| 灌阳县| 闽侯县| 墨竹工卡县| 西青区| 买车| 南江县| 邓州市| 长治县| 广安市| 濉溪县| 开鲁县| 台湾省| 衡东县| 沁源县| 绥宁县| 邯郸市| 武功县| 平湖市| 安西县| 郓城县| 奎屯市| 遂平县| 迭部县| 登封市| 清远市| 博乐市| 琼结县| 翼城县| 兴国县| 会理县| 景东| 当涂县| 沂南县| 梁山县|