The If statement is a conditional logic branching in computer programming. It contains the true and false statement in a computer terminology. The true statement evaluates a nonzero value while the false statement evaluates a zero value.
This conditional logic is not just for computer programming but this can be also used in your daily life without realizing you’re doing it.
For instance, if you know how to catch fish then you have something to eat for the day but if not, you will be hungry the whole day.
Here’s the example of if and else statement:
- Dim name as String
- name = "Kenjie"
- If name= "kenjie" Then
- MessageBox.Show( "Name is Kenjie" )
- MessageBox.Show( "Name is not Kenjie" )
- End If