coffeescript检查是否有条件

时间:2014-06-10 12:26:34

标签: coffeescript

这项工作需要考虑if k isnt 'notifications_table

v for k,v of tablesDict if k isnt 'notifications_table'

如何让它像python for一样工作,if statment在同一行中给出条件。

1 个答案:

答案 0 :(得分:1)

尝试:

v for k,v of tablesDict when k isnt 'notifications_table'

从CoffeeScript docs中过滤示例:

# Health conscious meal.
foods = ['broccoli', 'spinach', 'chocolate']
eat food for food in foods when food isnt 'chocolate'