Created
June 28, 2013 07:52
-
-
Save lexdene/5883165 to your computer and use it in GitHub Desktop.
吐槽一下coffee的语法
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # coffee可以这样写 | |
| foo() if 0 == a | |
| # 也可以这样写 | |
| if 0 == a then foo() else bar() | |
| # 但是不能可以这样写,编译出来根本不是我想要的效果 | |
| foo() if 0 == a else bar() | |
| # 也不能这样写,会报语法错误 | |
| b = 1 if 0 == a else 2 | |
| # 我只能这样写 | |
| b = (if 0 == a then 1 else 2) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment