}
if (condition) {
statements;
} else {
statements;
}
if (condition) {
statements;
} else if (condition) {
statements;
} else{
statements;
}
注意:if语句总是用"{"和"}"括起来,避免使用如下容易引起错误的格式:
if (condition) //AVOID! THIS OMITS THE BRACES {}!
statement;
7.5 for语句(for Statements)
一个for语句应该具有如下格式:
for (initialization; condition; update) {
statements;
}
文章来源于领测软件测试网 https://www.ltesting.net/