際際滷

際際滷Share a Scribd company logo
IF
IF is All Around Us Everyday
IF it is cold out THEN you will put a coat on
ELSE leave the coat at home

IF you do your homestudy THEN no detention
ELSE you get a detention
IF Is Like A Test With An Effect
The test: Is it cold?    The Effect if the test is True:
                         Put your coat on



 IF it is cold out THEN you will put a coat on
 ELSE leave the coat at home

          The Effect if the test is
          False: Leave coat at home
The Structure of IF in VB
If <TEST> Then

<CODE IF THE TEST IS TRUE>

Else :

<CODE IF THE TEST IS FALSE>

End If
Are You Old Enough To Drink?
Module Module1

    Sub Main()

        Dim age As Integer = 14

        If age > 16 Then
            Console.WriteLine("old enough")
            Console.ReadLine()
        Else : Console.WriteLine("Your not old enough!!")
            Console.ReadLine()
        End If


    End Sub

End Module
Are You Old Enough To Drink?  With
             User Input
Module Module1

    Sub Main()

        Dim age As Integer

        Console.WriteLine("ENTER YOUR AGE")
        age = Console.ReadLine()

        If age > 16 Then
            Console.WriteLine("old enough")
            Console.ReadLine()
        Else : Console.WriteLine("Your not old enough!!")
            Console.ReadLine()
        End If
   End Sub
End Module

More Related Content

If

  • 1. IF
  • 2. IF is All Around Us Everyday IF it is cold out THEN you will put a coat on ELSE leave the coat at home IF you do your homestudy THEN no detention ELSE you get a detention
  • 3. IF Is Like A Test With An Effect The test: Is it cold? The Effect if the test is True: Put your coat on IF it is cold out THEN you will put a coat on ELSE leave the coat at home The Effect if the test is False: Leave coat at home
  • 4. The Structure of IF in VB If <TEST> Then <CODE IF THE TEST IS TRUE> Else : <CODE IF THE TEST IS FALSE> End If
  • 5. Are You Old Enough To Drink? Module Module1 Sub Main() Dim age As Integer = 14 If age > 16 Then Console.WriteLine("old enough") Console.ReadLine() Else : Console.WriteLine("Your not old enough!!") Console.ReadLine() End If End Sub End Module
  • 6. Are You Old Enough To Drink? With User Input Module Module1 Sub Main() Dim age As Integer Console.WriteLine("ENTER YOUR AGE") age = Console.ReadLine() If age > 16 Then Console.WriteLine("old enough") Console.ReadLine() Else : Console.WriteLine("Your not old enough!!") Console.ReadLine() End If End Sub End Module