Option Explicit
' 普通のIfステートメント
Sub TEST1()
Dim A As Integer
Dim B As Integer
A = 1
B = 1
If A = B Then
MsgBox "AとBは等しい"
Else
MsgBox "AとBは等しくない"
End If
End Sub
Option Explicit
' 「正しい」の値?
Sub TEST2()
Dim A As Integer
Dim B As Integer
A = 1
B = 1
MsgBox A = B
End Sub
Option Explicit
' 「正しくない」の値?
Sub TEST3()
Dim A As Integer
Dim B As Integer
A = 1
B = 9
MsgBox A = B
End Sub
Option Explicit
' 「正しい」「正しくない」のデータ型
Sub TEST4()
Dim A As Integer
Dim B As Integer
A = 1
B = 9
MsgBox TypeName(A = B)
End Sub
Option Explicit
' Orを使った間違いのサンプル
Sub TEST5()
Dim A As Integer
A = 3
If A = 1 Or 2 Then
MsgBox "Aは1か2のどちらかだ"
Else
MsgBox "Aは1でも2でもない"
End If
End Sub
If A = 1 Or A = 2 Then
If A = 1 Or 2 Then
If 2 Then
Option Explicit
' 「2」は「True」なのか
Sub TEST6()
MsgBox CBool(2)
End Sub
If A <> 0 Then
If A Then