WEEK6 - Week6 ClicktoeditMastersubtitlestyle DoLoops...

Info iconThis preview shows pages 1–8. Sign up to view the full content.

View Full Document Right Arrow Icon
Click to edit Master subtitle style  3/14/11  Dr. LALE T. ERGENE Week 6 Do Loops
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
 3/14/11  Dr. LALE T. ERGENE 22 The   case   construct (from previous lecture) In some situations it is necessary to have an ordering built into the decision  as to which choice to take, because there is an overlap between some of the  possible decision criteria. EXAMPLE 1  : Consider that you are a basketball addict, but especially a Efes-Pilsen fan, then the decision as to what to do on Saturday afternoon might look like this, if  it is the basketball season and the Efes are at home  then ->go to Abdi Ipekci else if   it is the basketball season and the game is on TV  then ->watch the game on TV else if   it is the basketball season  then
Background image of page 2
 3/14/11  Dr. LALE T. ERGENE 33 The   case   construct EXAMPLE 2  : Consider that you are a soccer fan, and are only  interested in watching football matches in which they are playing  (whether at home or away), then your Saturday evening decision  plan might be rather different : if   it is the football season and your team is playing at home  then -> go to football field and support your team else if   it is the football season and your team is playing away  then ->go to wherever they are playing and support the team else ->watch some of your team’s old match videos at home
Background image of page 3

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
 3/14/11  Dr. LALE T. ERGENE 44 The   case   construct Depending on the previous example the following alternatives can be  selected as appropriate  case   - structure : Case 1  : It is it is the football season and your team is playing at home decision : go to football field and and support the team Case 2  : it is the football season and your team is playing away decision : go to wherever they are playing and support the team Case 3  : any other situation     decision : watch some of your old match videos at home It is obvious from the given example that,  case  – construct is not as 
Background image of page 4
 3/14/11  Dr. LALE T. ERGENE 55 The   case   construct select case ( case_expression ) case ( case_selector ) block_of_statements ... case default block_of_statements end select
Background image of page 5

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
 3/14/11  Dr. LALE T. ERGENE 66 The   case   construct o Case expression: n either integer or character expression o Case selector: n case_value o case_expression = = case_value n low_value : o low_value <= case_expression n : high_value o case_expression <= high_value n low_value : high_value o low_value <= case_expression .and.
Background image of page 6
 3/14/11  Dr. LALE T. ERGENE 77 Execution of the  case  - construct Execution of the case – construct begins with evaluation of the  selector   expression in the “select case” – statement. The case – statements are then executed in the order of their
Background image of page 7

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Image of page 8
This is the end of the preview. Sign up to access the rest of the document.

This document was uploaded on 03/13/2011.

Page1 / 32

WEEK6 - Week6 ClicktoeditMastersubtitlestyle DoLoops...

This preview shows document pages 1 - 8. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online