SlideShare uma empresa Scribd logo
1 de 9
Basic Scientific Programming
Case Statement
The Case Construct


Used in cases where exactly one of several alternative actions is
selected and performed.

form
Select Case(Selector)
case(label-list1)
statement sequence1
case(label-list2)
statement sequence2
“
case(label-list n)
statement sequence n
End select




Selector is an integer, character, or logical
expression.
The values in the list may have any of the forms:
(value)
single value
(value1: value2) range of values from value1 through
value2.
(value1:)
range of values greater than or equal
to value1
(: value2)
range of values less than or equal to
value2
Example


Select Case(Class_Code)
Case(1)
print*,’Freshman’
Case(2)
print*,’Sophomore’
Case(3)
print*,’Junior’
Case(4)
print*,’Senior’
Case Default
print*, ‚error,Illegal code‛
End Select
Example: Pollution Index




A case statement can be used to carry
out the classification given (good, fair,
or poor).
A case statement can be used to
replace an IF / ELSE IF structure.
Range Selectors “Integers”


Select Case(Int(average))
case(90:)
grade = ‚A‛
case(80:89)
grade = ‚B‛
case(70:79)
grade = ‚C‛
case(60:69)
grade = ‚D‛
case(:59)
grade = ‚F‛
End Select
Range Selectors “Characters”


Select Case(char)
case(‘A’: ‘Z’)
Print*, ‘uppercase’
case(‘a’: ’z’)
Print*, ‘lowercase’
case(‘0’:’9’)
Print*, ‘numbers’
case default
Print*, ‘Not a letter or number’
End Select
What about real valued selectors??




A selector can’t be of type real.
To make a selection, convert the real
number to an integer and then use it
for the selection.
example
Suppose a motors’ RPM is determined by an indicator x.
 high speed
x>= 5.5
 normal speed 2.5<= x < 5.5
 Low speed
x < 2.5
Select Case(int(10*x))

case(55:)
print*, ‚HIGH SPEED‛
case(25:54)
print*, ‚NORMAL SPEED‛
case(:24)
print*, ‚LOW SPEED‛
End Select

Mais conteúdo relacionado

Mais procurados

Excel functions formulas
Excel functions formulasExcel functions formulas
Excel functions formulas
LearnIT@UD
 
اىفناىنمفبانفيا
اىفناىنمفبانفيااىفناىنمفبانفيا
اىفناىنمفبانفيا
Bisan Rjoub
 

Mais procurados (16)

ASNP
ASNPASNP
ASNP
 
Logistic regression
Logistic regressionLogistic regression
Logistic regression
 
June 2015
June 2015June 2015
June 2015
 
Excel functions formulas
Excel functions formulasExcel functions formulas
Excel functions formulas
 
spss teaching
spss teachingspss teaching
spss teaching
 
SPSS How to use Spss software
SPSS How to use Spss softwareSPSS How to use Spss software
SPSS How to use Spss software
 
اىفناىنمفبانفيا
اىفناىنمفبانفيااىفناىنمفبانفيا
اىفناىنمفبانفيا
 
Spss basics tutorial
Spss basics tutorialSpss basics tutorial
Spss basics tutorial
 
SPSS-SYNTAX
SPSS-SYNTAXSPSS-SYNTAX
SPSS-SYNTAX
 
Tutorial of SPSS
Tutorial of SPSSTutorial of SPSS
Tutorial of SPSS
 
An Introduction to SPSS
An Introduction to SPSSAn Introduction to SPSS
An Introduction to SPSS
 
Practice Test 5B Multinomial Experiments and Contingency Tables
Practice Test 5B Multinomial Experiments and Contingency TablesPractice Test 5B Multinomial Experiments and Contingency Tables
Practice Test 5B Multinomial Experiments and Contingency Tables
 
RSS 2012 Data Entry SPSS
RSS 2012 Data Entry SPSSRSS 2012 Data Entry SPSS
RSS 2012 Data Entry SPSS
 
AMOS tutorial (Estimated Effect in AMOS)
AMOS tutorial (Estimated Effect in AMOS)AMOS tutorial (Estimated Effect in AMOS)
AMOS tutorial (Estimated Effect in AMOS)
 
Evaluation of multilabel multi class classification
Evaluation of multilabel multi class classificationEvaluation of multilabel multi class classification
Evaluation of multilabel multi class classification
 
Comparison statisticalsignificancetestir
Comparison statisticalsignificancetestirComparison statisticalsignificancetestir
Comparison statisticalsignificancetestir
 

Destaque

9 bí quyết học giỏi của các sinh viên Mỹ
9 bí quyết học giỏi của các sinh viên Mỹ9 bí quyết học giỏi của các sinh viên Mỹ
9 bí quyết học giỏi của các sinh viên Mỹ
phamhuytranlinh840836
 
9 f = 3 julianto arif setiadi bahrul ulum
9 f = 3 julianto arif setiadi   bahrul ulum9 f = 3 julianto arif setiadi   bahrul ulum
9 f = 3 julianto arif setiadi bahrul ulum
Eka Dhani
 
9.geo sorumluluk
9.geo sorumluluk9.geo sorumluluk
9.geo sorumluluk
matiz-4
 
9. b.n.septiembre 2013
9. b.n.septiembre 20139. b.n.septiembre 2013
9. b.n.septiembre 2013
colegionusefa
 
9 infidelidad peligro y prevencion
9 infidelidad peligro y prevencion9 infidelidad peligro y prevencion
9 infidelidad peligro y prevencion
Andy Esqueche
 
第9讲 Eigrp
第9讲 Eigrp第9讲 Eigrp
第9讲 Eigrp
F.l. Yu
 
9 EXPLANATION\MEANING OF PRATIKRAMANA SUTRAS VARAKANAKA STUTI, SHRI BHAVANA ...
9 EXPLANATION\MEANING OF PRATIKRAMANA SUTRAS  VARAKANAKA STUTI, SHRI BHAVANA ...9 EXPLANATION\MEANING OF PRATIKRAMANA SUTRAS  VARAKANAKA STUTI, SHRI BHAVANA ...
9 EXPLANATION\MEANING OF PRATIKRAMANA SUTRAS VARAKANAKA STUTI, SHRI BHAVANA ...
mehtavikas99
 
9 discapacidad visual sesion 9 de 14
9 discapacidad visual sesion 9 de 149 discapacidad visual sesion 9 de 14
9 discapacidad visual sesion 9 de 14
Armando Gr
 

Destaque (20)

9. impresiones 3d
9. impresiones 3d9. impresiones 3d
9. impresiones 3d
 
«Перспективы и тенденции продвижения поведенческими факторами в 2015 году», К...
«Перспективы и тенденции продвижения поведенческими факторами в 2015 году», К...«Перспективы и тенденции продвижения поведенческими факторами в 2015 году», К...
«Перспективы и тенденции продвижения поведенческими факторами в 2015 году», К...
 
9 bí quyết học giỏi của các sinh viên Mỹ
9 bí quyết học giỏi của các sinh viên Mỹ9 bí quyết học giỏi của các sinh viên Mỹ
9 bí quyết học giỏi của các sinh viên Mỹ
 
9 f = 3 julianto arif setiadi bahrul ulum
9 f = 3 julianto arif setiadi   bahrul ulum9 f = 3 julianto arif setiadi   bahrul ulum
9 f = 3 julianto arif setiadi bahrul ulum
 
9.geo sorumluluk
9.geo sorumluluk9.geo sorumluluk
9.geo sorumluluk
 
9 frame sequence
9 frame sequence9 frame sequence
9 frame sequence
 
9. environmental health and toxicology
9. environmental health and toxicology9. environmental health and toxicology
9. environmental health and toxicology
 
9.estandares superior ebr_peru
9.estandares superior ebr_peru9.estandares superior ebr_peru
9.estandares superior ebr_peru
 
9. b.n.septiembre 2013
9. b.n.septiembre 20139. b.n.septiembre 2013
9. b.n.septiembre 2013
 
9febbraio2013
9febbraio20139febbraio2013
9febbraio2013
 
9 infidelidad peligro y prevencion
9 infidelidad peligro y prevencion9 infidelidad peligro y prevencion
9 infidelidad peligro y prevencion
 
Nove 'coisas' que desaparecerão
Nove 'coisas' que desaparecerão Nove 'coisas' que desaparecerão
Nove 'coisas' que desaparecerão
 
第9讲 Eigrp
第9讲 Eigrp第9讲 Eigrp
第9讲 Eigrp
 
9.El método científico
9.El método  científico9.El método  científico
9.El método científico
 
Appcelerator Titanium Alloy + Kinvey Collection Databinding - Part One
Appcelerator Titanium Alloy + Kinvey Collection Databinding - Part OneAppcelerator Titanium Alloy + Kinvey Collection Databinding - Part One
Appcelerator Titanium Alloy + Kinvey Collection Databinding - Part One
 
9 EXPLANATION\MEANING OF PRATIKRAMANA SUTRAS VARAKANAKA STUTI, SHRI BHAVANA ...
9 EXPLANATION\MEANING OF PRATIKRAMANA SUTRAS  VARAKANAKA STUTI, SHRI BHAVANA ...9 EXPLANATION\MEANING OF PRATIKRAMANA SUTRAS  VARAKANAKA STUTI, SHRI BHAVANA ...
9 EXPLANATION\MEANING OF PRATIKRAMANA SUTRAS VARAKANAKA STUTI, SHRI BHAVANA ...
 
9 discapacidad visual sesion 9 de 14
9 discapacidad visual sesion 9 de 149 discapacidad visual sesion 9 de 14
9 discapacidad visual sesion 9 de 14
 
Generació automàtica d'informació de línies de transport
Generació automàtica d'informació de línies de transportGeneració automàtica d'informació de línies de transport
Generació automàtica d'informació de línies de transport
 
9. Pilot models of onion cultivation for adaptation to drought and salinity
9. Pilot models of onion cultivation for adaptation to drought and salinity9. Pilot models of onion cultivation for adaptation to drought and salinity
9. Pilot models of onion cultivation for adaptation to drought and salinity
 
9.EOS070529
9.EOS0705299.EOS070529
9.EOS070529
 

Mais de fyjordan9

Mais de fyjordan9 (16)

17recursion
17recursion17recursion
17recursion
 
16 subroutine
16 subroutine16 subroutine
16 subroutine
 
15 functions
15 functions15 functions
15 functions
 
14 arrays
14 arrays14 arrays
14 arrays
 
13 arrays
13 arrays13 arrays
13 arrays
 
12 doloops
12 doloops12 doloops
12 doloops
 
11 doloops
11 doloops11 doloops
11 doloops
 
10 examples for if statement
10 examples for if statement10 examples for if statement
10 examples for if statement
 
7 files
7 files7 files
7 files
 
6 read write
6 read write6 read write
6 read write
 
5 format
5 format5 format
5 format
 
4 design
4 design4 design
4 design
 
3 in out
3 in out3 in out
3 in out
 
2 int real
2 int real2 int real
2 int real
 
1 arithmetic
1 arithmetic1 arithmetic
1 arithmetic
 
PHYS303
PHYS303PHYS303
PHYS303
 

Último

Activity 01 - Artificial Culture (1).pdf
Activity 01 - Artificial Culture (1).pdfActivity 01 - Artificial Culture (1).pdf
Activity 01 - Artificial Culture (1).pdf
ciinovamais
 
The basics of sentences session 3pptx.pptx
The basics of sentences session 3pptx.pptxThe basics of sentences session 3pptx.pptx
The basics of sentences session 3pptx.pptx
heathfieldcps1
 

Último (20)

SOC 101 Demonstration of Learning Presentation
SOC 101 Demonstration of Learning PresentationSOC 101 Demonstration of Learning Presentation
SOC 101 Demonstration of Learning Presentation
 
Introduction to Nonprofit Accounting: The Basics
Introduction to Nonprofit Accounting: The BasicsIntroduction to Nonprofit Accounting: The Basics
Introduction to Nonprofit Accounting: The Basics
 
TỔNG ÔN TẬP THI VÀO LỚP 10 MÔN TIẾNG ANH NĂM HỌC 2023 - 2024 CÓ ĐÁP ÁN (NGỮ Â...
TỔNG ÔN TẬP THI VÀO LỚP 10 MÔN TIẾNG ANH NĂM HỌC 2023 - 2024 CÓ ĐÁP ÁN (NGỮ Â...TỔNG ÔN TẬP THI VÀO LỚP 10 MÔN TIẾNG ANH NĂM HỌC 2023 - 2024 CÓ ĐÁP ÁN (NGỮ Â...
TỔNG ÔN TẬP THI VÀO LỚP 10 MÔN TIẾNG ANH NĂM HỌC 2023 - 2024 CÓ ĐÁP ÁN (NGỮ Â...
 
Activity 01 - Artificial Culture (1).pdf
Activity 01 - Artificial Culture (1).pdfActivity 01 - Artificial Culture (1).pdf
Activity 01 - Artificial Culture (1).pdf
 
Kodo Millet PPT made by Ghanshyam bairwa college of Agriculture kumher bhara...
Kodo Millet  PPT made by Ghanshyam bairwa college of Agriculture kumher bhara...Kodo Millet  PPT made by Ghanshyam bairwa college of Agriculture kumher bhara...
Kodo Millet PPT made by Ghanshyam bairwa college of Agriculture kumher bhara...
 
Mixin Classes in Odoo 17 How to Extend Models Using Mixin Classes
Mixin Classes in Odoo 17  How to Extend Models Using Mixin ClassesMixin Classes in Odoo 17  How to Extend Models Using Mixin Classes
Mixin Classes in Odoo 17 How to Extend Models Using Mixin Classes
 
The basics of sentences session 3pptx.pptx
The basics of sentences session 3pptx.pptxThe basics of sentences session 3pptx.pptx
The basics of sentences session 3pptx.pptx
 
Fostering Friendships - Enhancing Social Bonds in the Classroom
Fostering Friendships - Enhancing Social Bonds  in the ClassroomFostering Friendships - Enhancing Social Bonds  in the Classroom
Fostering Friendships - Enhancing Social Bonds in the Classroom
 
HMCS Max Bernays Pre-Deployment Brief (May 2024).pptx
HMCS Max Bernays Pre-Deployment Brief (May 2024).pptxHMCS Max Bernays Pre-Deployment Brief (May 2024).pptx
HMCS Max Bernays Pre-Deployment Brief (May 2024).pptx
 
Unit-IV- Pharma. Marketing Channels.pptx
Unit-IV- Pharma. Marketing Channels.pptxUnit-IV- Pharma. Marketing Channels.pptx
Unit-IV- Pharma. Marketing Channels.pptx
 
General Principles of Intellectual Property: Concepts of Intellectual Proper...
General Principles of Intellectual Property: Concepts of Intellectual  Proper...General Principles of Intellectual Property: Concepts of Intellectual  Proper...
General Principles of Intellectual Property: Concepts of Intellectual Proper...
 
ICT Role in 21st Century Education & its Challenges.pptx
ICT Role in 21st Century Education & its Challenges.pptxICT Role in 21st Century Education & its Challenges.pptx
ICT Role in 21st Century Education & its Challenges.pptx
 
Dyslexia AI Workshop for Slideshare.pptx
Dyslexia AI Workshop for Slideshare.pptxDyslexia AI Workshop for Slideshare.pptx
Dyslexia AI Workshop for Slideshare.pptx
 
On National Teacher Day, meet the 2024-25 Kenan Fellows
On National Teacher Day, meet the 2024-25 Kenan FellowsOn National Teacher Day, meet the 2024-25 Kenan Fellows
On National Teacher Day, meet the 2024-25 Kenan Fellows
 
Application orientated numerical on hev.ppt
Application orientated numerical on hev.pptApplication orientated numerical on hev.ppt
Application orientated numerical on hev.ppt
 
FSB Advising Checklist - Orientation 2024
FSB Advising Checklist - Orientation 2024FSB Advising Checklist - Orientation 2024
FSB Advising Checklist - Orientation 2024
 
Food safety_Challenges food safety laboratories_.pdf
Food safety_Challenges food safety laboratories_.pdfFood safety_Challenges food safety laboratories_.pdf
Food safety_Challenges food safety laboratories_.pdf
 
Understanding Accommodations and Modifications
Understanding  Accommodations and ModificationsUnderstanding  Accommodations and Modifications
Understanding Accommodations and Modifications
 
SKILL OF INTRODUCING THE LESSON MICRO SKILLS.pptx
SKILL OF INTRODUCING THE LESSON MICRO SKILLS.pptxSKILL OF INTRODUCING THE LESSON MICRO SKILLS.pptx
SKILL OF INTRODUCING THE LESSON MICRO SKILLS.pptx
 
How to Manage Global Discount in Odoo 17 POS
How to Manage Global Discount in Odoo 17 POSHow to Manage Global Discount in Odoo 17 POS
How to Manage Global Discount in Odoo 17 POS
 

9 case