Show page source of StmIfThenElse #88109

= If-Then-Else
条件分岐します。

[[BR]]
=== 構文 1
{{{
If condition Then statements
}}}
=== 構文 2
{{{
If condition Then statements1 Else statements2
}}}
=== 構文 3
{{{
If condition Then
  statements
End If
}}}
=== 構文 4
{{{
If condition Then
  statements1
Else
  statements2
End If
}}}
=== 構文 5
{{{
If condition1 Then
  statements1
ElseIf condition2 Then
  statements2
ElseIf condition3 Then
  statements3
End If
}}}
=== 構文 6
{{{
If condition1 Then
  statements1
ElseIf condition2 Then
  statements2
ElseIf condition3 Then
  statements3
Else
  statements
End If
}}}

[[BR]]
==== ''condition''
ブール値、または結果がブール値になる式
==== ''statement''
実行する式

[[BR]]
=== 解説
1 と 3 の形式では、condition が True と評価された場合、statements が実行されます。

2 と 4 の形式では、condition が True と評価された場合は statements1 が、False と評価された場合は statements2 が実行されます。

5 と 6 の形式では、上から順に condition が評価されていって、True になった場所の statements が実行されます。一つも True にならなければ、Else があれば Else の所の statements が実行されます。