?
Dieses Dokument verwendet PHP-Handbuch für chinesische Websites Freigeben
JScript? | 語言參考 |
根據(jù)表達式的值,有條件地執(zhí)行一組語句。
@if (
? condition1)
???text1[@elif (
? condition2)
???text2]
[@else
???text3]
@end
condition1, condition2
可選項??梢詮娭妻D(zhuǎn)換為 Boolean 表達式的表達式。
text1
可選項。condition1 是 true 時要解析的文本。
text2
可選項。condition1 是 false 且 condition2 是 true 時要解析的文本。
text3
可選項。condition1 和 condition2 都是 false 時要解析的文本。
在書寫 @if 語句時,不必將每個子句放到不同的行??梢允褂枚鄠€ @elif 子句。但是,所有 @elif 子句必須在 @else 子句之前出現(xiàn)。
通常使用 @if 語句來決定應(yīng)當(dāng)使用若干選項中的哪個選項來進行文本輸出。例如:
alert(@if (@_win32) "using Windows NT or Windows 95" @else "using Windows 3.1" @end)
版本 3
條件編譯 | 條件編譯變量 | @cc_on 語句 | @set 語句