【发布时间】:2021-11-07 22:53:39
【问题描述】:
在 JavaScript 中,我们可以使用以下单行:
const condition = true
let foo
condition && (foo = 'foo') // ???? one-liner
console.log(foo) // foo
我在 AHK 中试过这个:
condition := true
condition && (foo := "foo")
MsgBox % foo
但是,解释器抛出:
我只好把上面的代码改成下面提示“foo”:
condition := true
; ???? three lines
if (condition) {
foo := "foo"
}
MsgBox % foo
如何在 AHK 的一行中做这种类型的赋值?
【问题讨论】:
标签: operators autohotkey variable-assignment assignment-operator short-circuiting