Friday, November 29, 2019

 

Option Explicit

Sub if_else()
    Dim num As Integer
    num = 5
    
    If num = 1 Then
        Debug.Print "ichi"
    ElseIf num = 2 Then
        Debug.Print "ni"
    Else
        Debug.Print "not match"
    End If
End Sub



Sub select_case()

    Dim num As Integer
    num = 5
    Select Case num
        Case 1, 3, 5, 7, 9
            Debug.Print num & "は奇数です"
        Case 2, 4, 6, 8
            Debug.Print num & "は偶数です"
        Case Else
            Debug.Print "1から9までの値を指定してください"
    End Select

End Sub

Leave a Reply

Subscribe to Posts | Subscribe to Comments

- Copyright © Lập trình hệ thống nhúng Linux . Powered by Luong Duy Ninh -