Monday, January 31, 2011

If statement that makes one decision

  In this code i will show  an if statement  that makes only one decision. This would be helpful when making a program or application that would have to make one or more decisions.

 Dim scriptEngine as String
  
 If scriptEngine = "VB" Then
  
   runningVB = True
  
 End If
  
 messageBox.Show(runningVB)
  
 In this code many decisions are made.
  
 Dim intW As Integer = 10
  
 If intW > 11 Then
  
   MessageBox.Show("intX > 11")
  
 ElseIf intW < 5 Then  MessageBox.Show("intW < 5")
  
 Else
  
   MessageBox.Show("Fallback code block")
  
 End If
  

No comments:

Post a Comment