SlideShare a Scribd company logo
1 of 64
Hello!
I am Ma. Wennilou Porazo
1
The
Selection
Structure
After studying Lesson A, you should
be able to:
● Write pseudocode for the selection structure
● Create a flowchart to help you plan an application’s code
● Write an If . . . Th en . . . Else statement
● Include comparison operators and logical operators in a
selection structure’s condition
● Change the case of a string
● Determine the success of the TryParse method
3
Making Decisions in a Program
● Three basic control structures:
○ Sequence
○ Selection
○ Repetition
4
Making Decisions in a Program (cont.)
● All procedures in an application are written using
one or more of these structures
○ Procedures in previous chapters used the
sequence structure only
● A condition in a selection structure gives an
answer of either true or false
5
Making Decisions in a Program
(cont.)
● Single-alternative selection structure
● Tasks are performed only when its condition is
true
6
Making Decisions in a Program
(cont.)
● Dual-alternative selection structure
○ One set of tasks is performed if its condition
is true
■ Called the true path
● A different set of tasks is performed if its
condition is false
■ Called the false path
7
Making Decisions in a Program
(cont.)
● The words “if” and “end if” denote a selection
structure’s beginning and end
● The word “else” denotes the beginning of the
false path
8
9
10
11
12
13
14
15
16
Coding Selection Structures in Visual Basic
● If…Then…Else statement
○ Used to code single and dual-alternative
selection structures
● Statement block
○ The set of statements in each path
17
18
19
Comparison Operators
● Comparison operators
○ Used to compare two values
○ Always result in a True or False value
20
Comparison Operators (cont.)
● Rules for comparison operators:
○ They do not have an order of precedence
○ They are evaluated from left to right
○ They are evaluated after any arithmetic
operators in the expression
21
22
23
Comparison Operators (cont.)
● Using Comparison Operators: Swapping
Numeric Values
○ Uses a single-alternative selection structure
to determine if one number is greater than
another
24
25
26
27
28
29
Comparison Operators (cont.)
● Values input by the user are stored in variables
with procedure scope
● A temporary variable is used when values must be
swapped
○ Declared within a statement block
○ Block-level variable
30
Comparison Operators (cont.)
● Block scope
○ Restricts the use of a variable to the
statement block in which it is declared
31
32
● Using Comparison Operators: Displaying the
Sum or Difference
○ Uses a dual-alternative selection structure to
determine either the sum of or the difference
between two numbers
33
34
35
36
37
Logical Operators
● Logical operators
○ Used to create compound conditions
○ Expressions evaluate to a Boolean value
■ True or False
38
Logical Operators
● Six logical operators in Visual Basic:
○ Not
○ And
○ AndAlso
○ Or
○ OrElse
○ Xor
39
40
41
Logical Operators (cont.)
● Truth tables
○ Show how logical operators are evaluated
● Not operator
○ Reverses the truth-value of the condition
42
Logical Operators (cont.)
● And operator and AndAlso operator
○ Both operators combine two sub-conditions
○ The And operator always evaluates both conditions
○ AndAlso performs a short-circuit evaluation, which bypasses
the evaluation of a condition when the outcome can be
determined without it
○ The compound condition evaluates to true only when both
conditions are true
43
Logical Operators (cont.)
● Or operator or OrElse operator
○ Both operators combine two sub-conditions
○ The compound condition evaluates to true when either
or both conditions are true
○ OrElse is more efficient than Or
○ Evaluates to true only when both conditions are true
44
Logical Operators (cont.)
● Using the Truth Tables
○ You can use AndAlso and Xor
45
46
47
48
49
50
51
52
53
Converting a String to Uppercase or Lowercase
● String comparisons are case sensitive
● CharacterCasing property:
○ Three case values: Normal (default), Upper, Lower
54
Converting a String to Uppercase or Lowercase
● ToUpper method
○ Converts the string to uppercase
○ Example: If strSenior.ToUpper = "y“
● ToLower method
○ Converts the string to lowercase
55
56
57
Using the ToUpper and ToLower Methods:
Displaying a Message
● Procedure requirements:
○ Display the message: “We have a store in this
state”
○ Valid states: IL, IN, KY
○ Must handle case variations in the user’s input
58
● Can use ToLower or ToUpper
● Can assign a string variable to the input text
box’s value converted to uppercase
59
60
61
Lesson A, Summary
62
Reference
● Book
○ Programming with Microsoft Visual Basic
2010, 5th edition
○ Author: Diane Zak
63
Thanks!
64

More Related Content

What's hot

Selection Sort - Vipin Ramola
Selection Sort - Vipin RamolaSelection Sort - Vipin Ramola
Selection Sort - Vipin RamolaDipayan Sarkar
 
A brief study on linear programming solving methods
A brief study on linear programming solving methodsA brief study on linear programming solving methods
A brief study on linear programming solving methodsMayurjyotiNeog
 
Selection sort lab mannual
Selection sort lab mannualSelection sort lab mannual
Selection sort lab mannualmaamir farooq
 
Matrix operations in MATLAB
Matrix operations in MATLABMatrix operations in MATLAB
Matrix operations in MATLABSaloni Singhal
 
Conditional statements
Conditional statementsConditional statements
Conditional statementscherrybear2014
 
Merge sort analysis and its real time applications
Merge sort analysis and its real time applicationsMerge sort analysis and its real time applications
Merge sort analysis and its real time applicationsyazad dumasia
 
Class 2 variables, classes methods...
Class 2   variables, classes methods...Class 2   variables, classes methods...
Class 2 variables, classes methods...Fernando Loizides
 
Mathematical and logical operators
Mathematical and logical operatorsMathematical and logical operators
Mathematical and logical operatorsRGn Ebsin
 
c++ programming Unit 4 operators
c++ programming Unit 4 operatorsc++ programming Unit 4 operators
c++ programming Unit 4 operatorsAAKASH KUMAR
 
OPERATORS OF C++
OPERATORS OF C++OPERATORS OF C++
OPERATORS OF C++ANANT VYAS
 
Summary of MATLAB Functions-Part1
Summary of MATLAB Functions-Part1Summary of MATLAB Functions-Part1
Summary of MATLAB Functions-Part1Elaf A.Saeed
 

What's hot (20)

Output analysis of a single model
Output analysis of a single modelOutput analysis of a single model
Output analysis of a single model
 
Arithmetic operator
Arithmetic operatorArithmetic operator
Arithmetic operator
 
Chap 3(operator expression)
Chap 3(operator expression)Chap 3(operator expression)
Chap 3(operator expression)
 
Selection Sort - Vipin Ramola
Selection Sort - Vipin RamolaSelection Sort - Vipin Ramola
Selection Sort - Vipin Ramola
 
A brief study on linear programming solving methods
A brief study on linear programming solving methodsA brief study on linear programming solving methods
A brief study on linear programming solving methods
 
Selection sort lab mannual
Selection sort lab mannualSelection sort lab mannual
Selection sort lab mannual
 
2 r algebra
2 r algebra2 r algebra
2 r algebra
 
Matrix operations in MATLAB
Matrix operations in MATLABMatrix operations in MATLAB
Matrix operations in MATLAB
 
Matlab Files
Matlab FilesMatlab Files
Matlab Files
 
Conditional statements
Conditional statementsConditional statements
Conditional statements
 
Opeartor & expression
Opeartor & expressionOpeartor & expression
Opeartor & expression
 
Merge sort analysis and its real time applications
Merge sort analysis and its real time applicationsMerge sort analysis and its real time applications
Merge sort analysis and its real time applications
 
Class 2 variables, classes methods...
Class 2   variables, classes methods...Class 2   variables, classes methods...
Class 2 variables, classes methods...
 
Mathematical and logical operators
Mathematical and logical operatorsMathematical and logical operators
Mathematical and logical operators
 
2 1 expressions
2 1  expressions2 1  expressions
2 1 expressions
 
Sorting
SortingSorting
Sorting
 
c++ programming Unit 4 operators
c++ programming Unit 4 operatorsc++ programming Unit 4 operators
c++ programming Unit 4 operators
 
OPERATORS OF C++
OPERATORS OF C++OPERATORS OF C++
OPERATORS OF C++
 
Application of Stack, Link list , and Queue in Programming .
Application of Stack, Link list , and Queue in Programming .Application of Stack, Link list , and Queue in Programming .
Application of Stack, Link list , and Queue in Programming .
 
Summary of MATLAB Functions-Part1
Summary of MATLAB Functions-Part1Summary of MATLAB Functions-Part1
Summary of MATLAB Functions-Part1
 

Similar to CHAPTER 4- Lesson A

CS550 Presentation - On comparing classifiers by Slazberg
CS550 Presentation - On comparing classifiers by SlazbergCS550 Presentation - On comparing classifiers by Slazberg
CS550 Presentation - On comparing classifiers by Slazbergmustafa sarac
 
Input Space Partitioning
Input Space PartitioningInput Space Partitioning
Input Space PartitioningRiyad Parvez
 
Machine Learning with Spark and Cassandra - Model Selection Tests
Machine Learning with Spark and Cassandra - Model Selection TestsMachine Learning with Spark and Cassandra - Model Selection Tests
Machine Learning with Spark and Cassandra - Model Selection TestsAnant Corporation
 
Machine Learning Introduction by Dr.C.R.Dhivyaa Kongu Engineering College
Machine Learning Introduction by Dr.C.R.Dhivyaa Kongu Engineering CollegeMachine Learning Introduction by Dr.C.R.Dhivyaa Kongu Engineering College
Machine Learning Introduction by Dr.C.R.Dhivyaa Kongu Engineering CollegeDhivyaa C.R
 
Getting Started with Calc Manager for HFM
Getting Started with Calc Manager for HFMGetting Started with Calc Manager for HFM
Getting Started with Calc Manager for HFMAlithya
 
Control structures selection
Control structures   selectionControl structures   selection
Control structures selectionOnline
 
Taguchi design of experiments nov 24 2013
Taguchi design of experiments nov 24 2013Taguchi design of experiments nov 24 2013
Taguchi design of experiments nov 24 2013Charlton Inao
 
Paper reading: Cost-based Query Transformation in Oracle
Paper reading: Cost-based Query Transformation in OraclePaper reading: Cost-based Query Transformation in Oracle
Paper reading: Cost-based Query Transformation in OraclePingCAP
 
Data Engineer's Lunch #67: Machine Learning - Feature Selection
Data Engineer's Lunch #67: Machine Learning - Feature SelectionData Engineer's Lunch #67: Machine Learning - Feature Selection
Data Engineer's Lunch #67: Machine Learning - Feature SelectionAnant Corporation
 
Implementing Operations to combine Feature Models: The Partial lntersection Case
Implementing Operations to combine Feature Models: The Partial lntersection CaseImplementing Operations to combine Feature Models: The Partial lntersection Case
Implementing Operations to combine Feature Models: The Partial lntersection CaseJaime Chavarriaga
 
Data Engineer’s Lunch #67: Machine Learning - Feature Selection
Data Engineer’s Lunch #67: Machine Learning - Feature SelectionData Engineer’s Lunch #67: Machine Learning - Feature Selection
Data Engineer’s Lunch #67: Machine Learning - Feature SelectionAnant Corporation
 
Control structures i
Control structures i Control structures i
Control structures i Ahmad Idrees
 
A brief introduction to Searn Algorithm
A brief introduction to Searn AlgorithmA brief introduction to Searn Algorithm
A brief introduction to Searn AlgorithmSupun Abeysinghe
 
Unit 2 - Test Case Design
Unit 2 - Test Case DesignUnit 2 - Test Case Design
Unit 2 - Test Case DesignSelvi Vts
 

Similar to CHAPTER 4- Lesson A (20)

CS550 Presentation - On comparing classifiers by Slazberg
CS550 Presentation - On comparing classifiers by SlazbergCS550 Presentation - On comparing classifiers by Slazberg
CS550 Presentation - On comparing classifiers by Slazberg
 
Input Space Partitioning
Input Space PartitioningInput Space Partitioning
Input Space Partitioning
 
Machine Learning with Spark and Cassandra - Model Selection Tests
Machine Learning with Spark and Cassandra - Model Selection TestsMachine Learning with Spark and Cassandra - Model Selection Tests
Machine Learning with Spark and Cassandra - Model Selection Tests
 
Machine Learning Introduction by Dr.C.R.Dhivyaa Kongu Engineering College
Machine Learning Introduction by Dr.C.R.Dhivyaa Kongu Engineering CollegeMachine Learning Introduction by Dr.C.R.Dhivyaa Kongu Engineering College
Machine Learning Introduction by Dr.C.R.Dhivyaa Kongu Engineering College
 
UNIT I (6).pptx
UNIT I (6).pptxUNIT I (6).pptx
UNIT I (6).pptx
 
Getting Started with Calc Manager for HFM
Getting Started with Calc Manager for HFMGetting Started with Calc Manager for HFM
Getting Started with Calc Manager for HFM
 
Control structures selection
Control structures   selectionControl structures   selection
Control structures selection
 
JavaScript Operators
JavaScript OperatorsJavaScript Operators
JavaScript Operators
 
Taguchi design of experiments nov 24 2013
Taguchi design of experiments nov 24 2013Taguchi design of experiments nov 24 2013
Taguchi design of experiments nov 24 2013
 
Paper reading: Cost-based Query Transformation in Oracle
Paper reading: Cost-based Query Transformation in OraclePaper reading: Cost-based Query Transformation in Oracle
Paper reading: Cost-based Query Transformation in Oracle
 
Ppt lesson 08
Ppt lesson 08Ppt lesson 08
Ppt lesson 08
 
CHAPTER 3- Lesson A
CHAPTER 3- Lesson ACHAPTER 3- Lesson A
CHAPTER 3- Lesson A
 
Data Engineer's Lunch #67: Machine Learning - Feature Selection
Data Engineer's Lunch #67: Machine Learning - Feature SelectionData Engineer's Lunch #67: Machine Learning - Feature Selection
Data Engineer's Lunch #67: Machine Learning - Feature Selection
 
Implementing Operations to combine Feature Models: The Partial lntersection Case
Implementing Operations to combine Feature Models: The Partial lntersection CaseImplementing Operations to combine Feature Models: The Partial lntersection Case
Implementing Operations to combine Feature Models: The Partial lntersection Case
 
Data Engineer’s Lunch #67: Machine Learning - Feature Selection
Data Engineer’s Lunch #67: Machine Learning - Feature SelectionData Engineer’s Lunch #67: Machine Learning - Feature Selection
Data Engineer’s Lunch #67: Machine Learning - Feature Selection
 
Control structures i
Control structures i Control structures i
Control structures i
 
A brief introduction to Searn Algorithm
A brief introduction to Searn AlgorithmA brief introduction to Searn Algorithm
A brief introduction to Searn Algorithm
 
Ch05.pdf
Ch05.pdfCh05.pdf
Ch05.pdf
 
Unit 2 - Test Case Design
Unit 2 - Test Case DesignUnit 2 - Test Case Design
Unit 2 - Test Case Design
 
Operators in C Programming
Operators in C ProgrammingOperators in C Programming
Operators in C Programming
 

More from MLG College of Learning, Inc (20)

PC111.Lesson2
PC111.Lesson2PC111.Lesson2
PC111.Lesson2
 
PC111.Lesson1
PC111.Lesson1PC111.Lesson1
PC111.Lesson1
 
PC111-lesson1.pptx
PC111-lesson1.pptxPC111-lesson1.pptx
PC111-lesson1.pptx
 
PC LEESOON 6.pptx
PC LEESOON 6.pptxPC LEESOON 6.pptx
PC LEESOON 6.pptx
 
PC 106 PPT-09.pptx
PC 106 PPT-09.pptxPC 106 PPT-09.pptx
PC 106 PPT-09.pptx
 
PC 106 PPT-07
PC 106 PPT-07PC 106 PPT-07
PC 106 PPT-07
 
PC 106 PPT-01
PC 106 PPT-01PC 106 PPT-01
PC 106 PPT-01
 
PC 106 PPT-06
PC 106 PPT-06PC 106 PPT-06
PC 106 PPT-06
 
PC 106 PPT-05
PC 106 PPT-05PC 106 PPT-05
PC 106 PPT-05
 
PC 106 Slide 04
PC 106 Slide 04PC 106 Slide 04
PC 106 Slide 04
 
PC 106 Slide no.02
PC 106 Slide no.02PC 106 Slide no.02
PC 106 Slide no.02
 
pc-106-slide-3
pc-106-slide-3pc-106-slide-3
pc-106-slide-3
 
PC 106 Slide 2
PC 106 Slide 2PC 106 Slide 2
PC 106 Slide 2
 
PC 106 Slide 1.pptx
PC 106 Slide 1.pptxPC 106 Slide 1.pptx
PC 106 Slide 1.pptx
 
Db2 characteristics of db ms
Db2 characteristics of db msDb2 characteristics of db ms
Db2 characteristics of db ms
 
Db1 introduction
Db1 introductionDb1 introduction
Db1 introduction
 
Lesson 3.2
Lesson 3.2Lesson 3.2
Lesson 3.2
 
Lesson 3.1
Lesson 3.1Lesson 3.1
Lesson 3.1
 
Lesson 1.6
Lesson 1.6Lesson 1.6
Lesson 1.6
 
Lesson 3.2
Lesson 3.2Lesson 3.2
Lesson 3.2
 

Recently uploaded

Earth Day Presentation wow hello nice great
Earth Day Presentation wow hello nice greatEarth Day Presentation wow hello nice great
Earth Day Presentation wow hello nice greatYousafMalik24
 
Field Attribute Index Feature in Odoo 17
Field Attribute Index Feature in Odoo 17Field Attribute Index Feature in Odoo 17
Field Attribute Index Feature in Odoo 17Celine George
 
Q4 English4 Week3 PPT Melcnmg-based.pptx
Q4 English4 Week3 PPT Melcnmg-based.pptxQ4 English4 Week3 PPT Melcnmg-based.pptx
Q4 English4 Week3 PPT Melcnmg-based.pptxnelietumpap1
 
Like-prefer-love -hate+verb+ing & silent letters & citizenship text.pdf
Like-prefer-love -hate+verb+ing & silent letters & citizenship text.pdfLike-prefer-love -hate+verb+ing & silent letters & citizenship text.pdf
Like-prefer-love -hate+verb+ing & silent letters & citizenship text.pdfMr Bounab Samir
 
How to do quick user assign in kanban in Odoo 17 ERP
How to do quick user assign in kanban in Odoo 17 ERPHow to do quick user assign in kanban in Odoo 17 ERP
How to do quick user assign in kanban in Odoo 17 ERPCeline George
 
Proudly South Africa powerpoint Thorisha.pptx
Proudly South Africa powerpoint Thorisha.pptxProudly South Africa powerpoint Thorisha.pptx
Proudly South Africa powerpoint Thorisha.pptxthorishapillay1
 
ACC 2024 Chronicles. Cardiology. Exam.pdf
ACC 2024 Chronicles. Cardiology. Exam.pdfACC 2024 Chronicles. Cardiology. Exam.pdf
ACC 2024 Chronicles. Cardiology. Exam.pdfSpandanaRallapalli
 
What is Model Inheritance in Odoo 17 ERP
What is Model Inheritance in Odoo 17 ERPWhat is Model Inheritance in Odoo 17 ERP
What is Model Inheritance in Odoo 17 ERPCeline George
 
Difference Between Search & Browse Methods in Odoo 17
Difference Between Search & Browse Methods in Odoo 17Difference Between Search & Browse Methods in Odoo 17
Difference Between Search & Browse Methods in Odoo 17Celine George
 
ECONOMIC CONTEXT - LONG FORM TV DRAMA - PPT
ECONOMIC CONTEXT - LONG FORM TV DRAMA - PPTECONOMIC CONTEXT - LONG FORM TV DRAMA - PPT
ECONOMIC CONTEXT - LONG FORM TV DRAMA - PPTiammrhaywood
 
HỌC TỐT TIẾNG ANH 11 THEO CHƯƠNG TRÌNH GLOBAL SUCCESS ĐÁP ÁN CHI TIẾT - CẢ NĂ...
HỌC TỐT TIẾNG ANH 11 THEO CHƯƠNG TRÌNH GLOBAL SUCCESS ĐÁP ÁN CHI TIẾT - CẢ NĂ...HỌC TỐT TIẾNG ANH 11 THEO CHƯƠNG TRÌNH GLOBAL SUCCESS ĐÁP ÁN CHI TIẾT - CẢ NĂ...
HỌC TỐT TIẾNG ANH 11 THEO CHƯƠNG TRÌNH GLOBAL SUCCESS ĐÁP ÁN CHI TIẾT - CẢ NĂ...Nguyen Thanh Tu Collection
 
ECONOMIC CONTEXT - PAPER 1 Q3: NEWSPAPERS.pptx
ECONOMIC CONTEXT - PAPER 1 Q3: NEWSPAPERS.pptxECONOMIC CONTEXT - PAPER 1 Q3: NEWSPAPERS.pptx
ECONOMIC CONTEXT - PAPER 1 Q3: NEWSPAPERS.pptxiammrhaywood
 
Gas measurement O2,Co2,& ph) 04/2024.pptx
Gas measurement O2,Co2,& ph) 04/2024.pptxGas measurement O2,Co2,& ph) 04/2024.pptx
Gas measurement O2,Co2,& ph) 04/2024.pptxDr.Ibrahim Hassaan
 
Inclusivity Essentials_ Creating Accessible Websites for Nonprofits .pdf
Inclusivity Essentials_ Creating Accessible Websites for Nonprofits .pdfInclusivity Essentials_ Creating Accessible Websites for Nonprofits .pdf
Inclusivity Essentials_ Creating Accessible Websites for Nonprofits .pdfTechSoup
 
ANG SEKTOR NG agrikultura.pptx QUARTER 4
ANG SEKTOR NG agrikultura.pptx QUARTER 4ANG SEKTOR NG agrikultura.pptx QUARTER 4
ANG SEKTOR NG agrikultura.pptx QUARTER 4MiaBumagat1
 
Keynote by Prof. Wurzer at Nordex about IP-design
Keynote by Prof. Wurzer at Nordex about IP-designKeynote by Prof. Wurzer at Nordex about IP-design
Keynote by Prof. Wurzer at Nordex about IP-designMIPLM
 

Recently uploaded (20)

Earth Day Presentation wow hello nice great
Earth Day Presentation wow hello nice greatEarth Day Presentation wow hello nice great
Earth Day Presentation wow hello nice great
 
Field Attribute Index Feature in Odoo 17
Field Attribute Index Feature in Odoo 17Field Attribute Index Feature in Odoo 17
Field Attribute Index Feature in Odoo 17
 
Q4 English4 Week3 PPT Melcnmg-based.pptx
Q4 English4 Week3 PPT Melcnmg-based.pptxQ4 English4 Week3 PPT Melcnmg-based.pptx
Q4 English4 Week3 PPT Melcnmg-based.pptx
 
Like-prefer-love -hate+verb+ing & silent letters & citizenship text.pdf
Like-prefer-love -hate+verb+ing & silent letters & citizenship text.pdfLike-prefer-love -hate+verb+ing & silent letters & citizenship text.pdf
Like-prefer-love -hate+verb+ing & silent letters & citizenship text.pdf
 
How to do quick user assign in kanban in Odoo 17 ERP
How to do quick user assign in kanban in Odoo 17 ERPHow to do quick user assign in kanban in Odoo 17 ERP
How to do quick user assign in kanban in Odoo 17 ERP
 
Proudly South Africa powerpoint Thorisha.pptx
Proudly South Africa powerpoint Thorisha.pptxProudly South Africa powerpoint Thorisha.pptx
Proudly South Africa powerpoint Thorisha.pptx
 
FINALS_OF_LEFT_ON_C'N_EL_DORADO_2024.pptx
FINALS_OF_LEFT_ON_C'N_EL_DORADO_2024.pptxFINALS_OF_LEFT_ON_C'N_EL_DORADO_2024.pptx
FINALS_OF_LEFT_ON_C'N_EL_DORADO_2024.pptx
 
ACC 2024 Chronicles. Cardiology. Exam.pdf
ACC 2024 Chronicles. Cardiology. Exam.pdfACC 2024 Chronicles. Cardiology. Exam.pdf
ACC 2024 Chronicles. Cardiology. Exam.pdf
 
LEFT_ON_C'N_ PRELIMS_EL_DORADO_2024.pptx
LEFT_ON_C'N_ PRELIMS_EL_DORADO_2024.pptxLEFT_ON_C'N_ PRELIMS_EL_DORADO_2024.pptx
LEFT_ON_C'N_ PRELIMS_EL_DORADO_2024.pptx
 
OS-operating systems- ch04 (Threads) ...
OS-operating systems- ch04 (Threads) ...OS-operating systems- ch04 (Threads) ...
OS-operating systems- ch04 (Threads) ...
 
What is Model Inheritance in Odoo 17 ERP
What is Model Inheritance in Odoo 17 ERPWhat is Model Inheritance in Odoo 17 ERP
What is Model Inheritance in Odoo 17 ERP
 
Difference Between Search & Browse Methods in Odoo 17
Difference Between Search & Browse Methods in Odoo 17Difference Between Search & Browse Methods in Odoo 17
Difference Between Search & Browse Methods in Odoo 17
 
ECONOMIC CONTEXT - LONG FORM TV DRAMA - PPT
ECONOMIC CONTEXT - LONG FORM TV DRAMA - PPTECONOMIC CONTEXT - LONG FORM TV DRAMA - PPT
ECONOMIC CONTEXT - LONG FORM TV DRAMA - PPT
 
TataKelola dan KamSiber Kecerdasan Buatan v022.pdf
TataKelola dan KamSiber Kecerdasan Buatan v022.pdfTataKelola dan KamSiber Kecerdasan Buatan v022.pdf
TataKelola dan KamSiber Kecerdasan Buatan v022.pdf
 
HỌC TỐT TIẾNG ANH 11 THEO CHƯƠNG TRÌNH GLOBAL SUCCESS ĐÁP ÁN CHI TIẾT - CẢ NĂ...
HỌC TỐT TIẾNG ANH 11 THEO CHƯƠNG TRÌNH GLOBAL SUCCESS ĐÁP ÁN CHI TIẾT - CẢ NĂ...HỌC TỐT TIẾNG ANH 11 THEO CHƯƠNG TRÌNH GLOBAL SUCCESS ĐÁP ÁN CHI TIẾT - CẢ NĂ...
HỌC TỐT TIẾNG ANH 11 THEO CHƯƠNG TRÌNH GLOBAL SUCCESS ĐÁP ÁN CHI TIẾT - CẢ NĂ...
 
ECONOMIC CONTEXT - PAPER 1 Q3: NEWSPAPERS.pptx
ECONOMIC CONTEXT - PAPER 1 Q3: NEWSPAPERS.pptxECONOMIC CONTEXT - PAPER 1 Q3: NEWSPAPERS.pptx
ECONOMIC CONTEXT - PAPER 1 Q3: NEWSPAPERS.pptx
 
Gas measurement O2,Co2,& ph) 04/2024.pptx
Gas measurement O2,Co2,& ph) 04/2024.pptxGas measurement O2,Co2,& ph) 04/2024.pptx
Gas measurement O2,Co2,& ph) 04/2024.pptx
 
Inclusivity Essentials_ Creating Accessible Websites for Nonprofits .pdf
Inclusivity Essentials_ Creating Accessible Websites for Nonprofits .pdfInclusivity Essentials_ Creating Accessible Websites for Nonprofits .pdf
Inclusivity Essentials_ Creating Accessible Websites for Nonprofits .pdf
 
ANG SEKTOR NG agrikultura.pptx QUARTER 4
ANG SEKTOR NG agrikultura.pptx QUARTER 4ANG SEKTOR NG agrikultura.pptx QUARTER 4
ANG SEKTOR NG agrikultura.pptx QUARTER 4
 
Keynote by Prof. Wurzer at Nordex about IP-design
Keynote by Prof. Wurzer at Nordex about IP-designKeynote by Prof. Wurzer at Nordex about IP-design
Keynote by Prof. Wurzer at Nordex about IP-design
 

CHAPTER 4- Lesson A

  • 1. Hello! I am Ma. Wennilou Porazo 1
  • 3. After studying Lesson A, you should be able to: ● Write pseudocode for the selection structure ● Create a flowchart to help you plan an application’s code ● Write an If . . . Th en . . . Else statement ● Include comparison operators and logical operators in a selection structure’s condition ● Change the case of a string ● Determine the success of the TryParse method 3
  • 4. Making Decisions in a Program ● Three basic control structures: ○ Sequence ○ Selection ○ Repetition 4
  • 5. Making Decisions in a Program (cont.) ● All procedures in an application are written using one or more of these structures ○ Procedures in previous chapters used the sequence structure only ● A condition in a selection structure gives an answer of either true or false 5
  • 6. Making Decisions in a Program (cont.) ● Single-alternative selection structure ● Tasks are performed only when its condition is true 6
  • 7. Making Decisions in a Program (cont.) ● Dual-alternative selection structure ○ One set of tasks is performed if its condition is true ■ Called the true path ● A different set of tasks is performed if its condition is false ■ Called the false path 7
  • 8. Making Decisions in a Program (cont.) ● The words “if” and “end if” denote a selection structure’s beginning and end ● The word “else” denotes the beginning of the false path 8
  • 9. 9
  • 10. 10
  • 11. 11
  • 12. 12
  • 13. 13
  • 14. 14
  • 15. 15
  • 16. 16
  • 17. Coding Selection Structures in Visual Basic ● If…Then…Else statement ○ Used to code single and dual-alternative selection structures ● Statement block ○ The set of statements in each path 17
  • 18. 18
  • 19. 19
  • 20. Comparison Operators ● Comparison operators ○ Used to compare two values ○ Always result in a True or False value 20
  • 21. Comparison Operators (cont.) ● Rules for comparison operators: ○ They do not have an order of precedence ○ They are evaluated from left to right ○ They are evaluated after any arithmetic operators in the expression 21
  • 22. 22
  • 23. 23
  • 24. Comparison Operators (cont.) ● Using Comparison Operators: Swapping Numeric Values ○ Uses a single-alternative selection structure to determine if one number is greater than another 24
  • 25. 25
  • 26. 26
  • 27. 27
  • 28. 28
  • 29. 29
  • 30. Comparison Operators (cont.) ● Values input by the user are stored in variables with procedure scope ● A temporary variable is used when values must be swapped ○ Declared within a statement block ○ Block-level variable 30
  • 31. Comparison Operators (cont.) ● Block scope ○ Restricts the use of a variable to the statement block in which it is declared 31
  • 32. 32
  • 33. ● Using Comparison Operators: Displaying the Sum or Difference ○ Uses a dual-alternative selection structure to determine either the sum of or the difference between two numbers 33
  • 34. 34
  • 35. 35
  • 36. 36
  • 37. 37
  • 38. Logical Operators ● Logical operators ○ Used to create compound conditions ○ Expressions evaluate to a Boolean value ■ True or False 38
  • 39. Logical Operators ● Six logical operators in Visual Basic: ○ Not ○ And ○ AndAlso ○ Or ○ OrElse ○ Xor 39
  • 40. 40
  • 41. 41
  • 42. Logical Operators (cont.) ● Truth tables ○ Show how logical operators are evaluated ● Not operator ○ Reverses the truth-value of the condition 42
  • 43. Logical Operators (cont.) ● And operator and AndAlso operator ○ Both operators combine two sub-conditions ○ The And operator always evaluates both conditions ○ AndAlso performs a short-circuit evaluation, which bypasses the evaluation of a condition when the outcome can be determined without it ○ The compound condition evaluates to true only when both conditions are true 43
  • 44. Logical Operators (cont.) ● Or operator or OrElse operator ○ Both operators combine two sub-conditions ○ The compound condition evaluates to true when either or both conditions are true ○ OrElse is more efficient than Or ○ Evaluates to true only when both conditions are true 44
  • 45. Logical Operators (cont.) ● Using the Truth Tables ○ You can use AndAlso and Xor 45
  • 46. 46
  • 47. 47
  • 48. 48
  • 49. 49
  • 50. 50
  • 51. 51
  • 52. 52
  • 53. 53
  • 54. Converting a String to Uppercase or Lowercase ● String comparisons are case sensitive ● CharacterCasing property: ○ Three case values: Normal (default), Upper, Lower 54
  • 55. Converting a String to Uppercase or Lowercase ● ToUpper method ○ Converts the string to uppercase ○ Example: If strSenior.ToUpper = "y“ ● ToLower method ○ Converts the string to lowercase 55
  • 56. 56
  • 57. 57
  • 58. Using the ToUpper and ToLower Methods: Displaying a Message ● Procedure requirements: ○ Display the message: “We have a store in this state” ○ Valid states: IL, IN, KY ○ Must handle case variations in the user’s input 58
  • 59. ● Can use ToLower or ToUpper ● Can assign a string variable to the input text box’s value converted to uppercase 59
  • 60. 60
  • 61. 61
  • 63. Reference ● Book ○ Programming with Microsoft Visual Basic 2010, 5th edition ○ Author: Diane Zak 63