好吧,我試圖理解Const
表達式中的限制VBScript
。除了文字之外,我無法使用任何東西。什麼the docs say是:瞭解VBScript中的Const表達式
Literal or other constant, or any combination that includes all arithmetic or logical operators exceptIs.
所以,如果「包括所有的算術或邏輯運算符」,那麼在邏輯上我希望我可以做這樣的事情:
Const X = (1 + 2)
但是,這帶來的錯誤「預期字面常量」。我發現一個有趣的答案here,允許一個作弊,在一定程度上,讓上面的功能也可以用:
Execute "Const X = " & (1 + 2)
但我的問題是關於標準定聲明。如果偶然的文件說像「表達可能只是字面意思」,那麼我永遠不會問。
那麼還有什麼我可以使用(除了文字)?
微軟的舊模糊不清。如果你做第一個沒有括號的話,會發生什麼? – bugmagnet 2013-03-20 01:22:25
test.vbs(1,16)Microsoft VBScript編譯錯誤:預期文字常量 – bugmagnet 2013-03-20 01:25:31
感謝您的快速回復。如果削減括號,沒有差異,相同的錯誤 – seeker 2013-03-20 01:26:17