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

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.

主站蜘蛛池模板: 依安县| 兴隆县| 商南县| 六安市| 五华县| 青神县| 梨树县| 小金县| 桃园县| 安宁市| 荥经县| 民乐县| 阿拉善右旗| 郓城县| 深州市| 丽江市| 永春县| 河池市| 绥滨县| 中方县| 云安县| 达拉特旗| 鹤岗市| 宝应县| 盘山县| 西充县| 米脂县| 渭源县| 谢通门县| 庆安县| 贵州省| 鄯善县| 崇仁县| 陇川县| 闽侯县| 安徽省| 台安县| 上蔡县| 当涂县| 准格尔旗| 治县。|