「Swift入門」if文を使うサンプルコード
書式
if boolean_expression_1 {
//code 1
} else if boolean_expression_2 {
// code 2
} else if boolean_expression_3 {
// code 3
} else {
// some code
}
サンプルコード
var varP:Int = 100;
if varP == 30 {
print("value is 30");
} else if varP == 50 {
print("value is 50");
} else {
print("no match");
}
print("varP value is \(varP)");