jagomart
digital resources
picture1_While Item Download 2023-02-02 13-08-02


 64x       Filetype PDF       File size 0.17 MB       Source: www.cs.cmu.edu


File: While Item Download 2023-02-02 13-08-02
while and do while loops 15 110 summer 2010 margaret reid miller loops within a method we can alter the flow of control using either conditionals or loops the loop ...

icon picture PDF Filetype PDF | Posted on 02 Feb 2023 | 2 years ago
Partial capture of text on file.
          While and Do-While Loops 
                15-110 Summer 2010 
                 Margaret Reid-Miller 
                  Loops 
                  •   Within a method, we can alter the flow of control 
                      using either conditionals or loops. 
                  •   The loop statements while, do-while, and for  
                      allow us execute a statement(s) over and over. 
                  •   Like a conditional, a loop is controlled by a boolean 
                      expression that determines how many times the 
                      statement is executed. 
                       E.g., You may want to calculate the interest paid on a mortgage 
                      for each year of the loan term. 
                  Summer 2010                              15-110 (Reid-Miller) 
                  The while statement 
                  •   The form of the while statement is  
                              while () 
                                       
                  •   If boolean_expression evaluates to true, then 
                      statement is executed. 
                  •   Then, the boolean_expression is evaluated again.  If 
                      it evaluates to true, statement is executed again. 
                  •   This repetition continues until the 
                      boolean_expression evaluates to false. 
                       How is the while loop different from the if statement? 
                  Summer 2010                              15-110 (Reid-Miller) 
           The if Flowchart 
                               boolean_expression    false 
                                   true 
                                    statement 
                                  (body of loop) 
           Summer 2010              15-110 (Reid-Miller) 
The words contained in this file might help you see if this file matches what you are looking for:

...While and do loops summer margaret reid miller within a method we can alter the flow of control using either conditionals or loop statements for allow us execute statement s over like conditional is controlled by boolean expression that determines how many times executed e g you may want to calculate interest paid on mortgage each year loan term form if evaluates true then evaluated again it this repetition continues until false different from flowchart body...

no reviews yet
Please Login to review.