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

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.

主站蜘蛛池模板: 科尔| 当阳市| 武乡县| 东山县| 青浦区| 仁化县| 嫩江县| 赤城县| 隆回县| 壤塘县| 沙雅县| 新化县| 印江| 荔波县| 兴海县| 新蔡县| 洞头县| 荔浦县| 桦川县| 临猗县| 北流市| 大悟县| 特克斯县| 芮城县| 兴仁县| 苏尼特右旗| 甘谷县| 喜德县| 高雄县| 彝良县| 彰武县| 都江堰市| 高安市| 晋江市| 景德镇市| 梅州市| 铁力市| 揭阳市| 兴和县| 台山市| 定襄县|