Skip to content

if的用法比较蛋疼 #61

@HerringtonDarkholme

Description

@HerringtonDarkholme

比如

div.test if test

这一句是可以编过的

但是

div.test @new-attr="whatever" if test

就是编不过的
这个又是一个需要记忆的用法

jedi里if,else的用法本身也有三种,作为instruction,作为后置条件,作为表达式,同一个token在不同环境下承担不同职责是不好学,不好找,不好记的 (极端的例子)

另外在长远看来,if后置的条件判断一定会变长,而一般开发的习惯一定是把条件全塞进一个if里(coffeescript是个先例

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions