Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/ionic-framework/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Coffeescript 为什么coffescript条件赋值在函数调用中不起作用?_Coffeescript - Fatal编程技术网

Coffeescript 为什么coffescript条件赋值在函数调用中不起作用?

Coffeescript 为什么coffescript条件赋值在函数调用中不起作用?,coffeescript,Coffeescript,我能行 fun = if state then "a" else "b" somefunction(fun, "param") 然而,我做不到 somefunction(if state then "a" else "b", "param") 咖啡1.8.0版。有什么好的理由吗?您是否尝试过函数if state然后a else b,param?什么是不能做?你有错误吗?谢谢。说到咖啡脚本,我一次又一次地陷入困境,没有看到明显的解决方案。。。

我能行

fun = if state then "a" else "b"
somefunction(fun, "param")
然而,我做不到

somefunction(if state then "a" else "b", "param")

咖啡1.8.0版。有什么好的理由吗?

您是否尝试过函数if state然后a else b,param?什么是不能做?你有错误吗?谢谢。说到咖啡脚本,我一次又一次地陷入困境,没有看到明显的解决方案。。。