?
This document uses PHP Chinese website manual Release
JScript? | 語(yǔ)言參考 |
根據(jù)表達(dá)式的值,有條件地執(zhí)行一組語(yǔ)句。
@if (
? condition1)
???text1[@elif (
? condition2)
???text2]
[@else
???text3]
@end
condition1, condition2
可選項(xiàng)??梢詮?qiáng)制轉(zhuǎn)換為 Boolean 表達(dá)式的表達(dá)式。
text1
可選項(xiàng)。condition1 是 true 時(shí)要解析的文本。
text2
可選項(xiàng)。condition1 是 false 且 condition2 是 true 時(shí)要解析的文本。
text3
可選項(xiàng)。condition1 和 condition2 都是 false 時(shí)要解析的文本。
在書(shū)寫(xiě) @if 語(yǔ)句時(shí),不必將每個(gè)子句放到不同的行??梢允褂枚鄠€(gè) @elif 子句。但是,所有 @elif 子句必須在 @else 子句之前出現(xiàn)。
通常使用 @if 語(yǔ)句來(lái)決定應(yīng)當(dāng)使用若干選項(xiàng)中的哪個(gè)選項(xiàng)來(lái)進(jìn)行文本輸出。例如:
alert(@if (@_win32) "using Windows NT or Windows 95" @else "using Windows 3.1" @end)
版本 3
條件編譯 | 條件編譯變量 | @cc_on 語(yǔ)句 | @set 語(yǔ)句