Visual Basic'net - PowerPoint PPT Presentation

1 / 12
About This Presentation
Title:

Visual Basic'net

Description:

Conditionals can have a true or false branch. Conditionals can have ... wear a raincoat. End if. Programming Syntax. A conditional in a program would appear as ... – PowerPoint PPT presentation

Number of Views:26
Avg rating:3.0/5.0
Slides: 13
Provided by: tonyr8
Category:
Tags: basic | net | raincoat | visual

less

Transcript and Presenter's Notes

Title: Visual Basic'net


1
Visual Basic.net
  • Conditionals

2
Conditionals
  • Used to decide the path a program takes
  • Conditionals can have a true or false branch
  • Conditionals can have both a true and false
    branch

3
If Then (Syntax)
  • The basic syntax of a conditional is
  • If (condition) then
  • (statements)
  • End if
  • note this is for a one branch only
  • conditional

4
Real World (Conditional)
  • You can apply conditional to real
  • world situations
  • If its raining then
  • wear a raincoat
  • End if

5
Programming Syntax
  • A conditional in a program would appear as
  • If intage 21 then
  • lblLegal.Caption You are legal to drink!
  • End if

6
If Then Else (Syntax)
  • You can have a conditional that has a
  • true and false branch
  • If (condition) then
  • (statements)
  • Else
  • (statements)
  • End if

7
Real World (If Then Else)
  • Here is a real world If, then, else
  • Example
  • If the buccaneers win then
  • Im happy!
  • Else
  • Im sad
  • End if

8
If, Then, Else Statement
9
Programming Syntax
  • Here is an example of If, then, else in
  • a program
  • If intsales lt 200 then
  • lblComment.Caption Try to sell more!
  • Else
  • lblComment.Caption Keep up the good work!
  • End if

10
Relational Operators
  • Equal to ()
  • Less than (lt)
  • Greater than (gt)
  • Not equal to (ltgt)
  • Less than equal to (lt)
  • Greater than equal to (gt)

11
Multiple Elses
  • You can have multiple branches within the same
    conditional statement
  • If (condition) then
  • (statement)
  • Else if (condition) then
  • (statement)
  • Else (condition) then
  • (statement)
  • End if

12
Multiple Branch If Statement
Write a Comment
User Comments (0)
About PowerShow.com