• Like
Kelompok 8 Pbw
Upcoming SlideShare
Loading in...5
×
Uploaded on

 

More in: Technology
  • Full Name Full Name Comment goes here.
    Are you sure you want to
    Your message goes here
    Be the first to comment
    Be the first to like this
No Downloads

Views

Total Views
133
On Slideshare
0
From Embeds
0
Number of Embeds
0

Actions

Shares
Downloads
0
Comments
0
Likes
0

Embeds 0

No embeds

Report content

Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel
    No notes for slide

Transcript

  • 1. Kelompok 8 Java Script : Control Statement II Oleh: Kukuh I. 5108100122 Brian M. 5108100156 Yodiar Hellian 5108100165
  • 2. Chapter 8 - JavaScript: Control Statements II 1. Introduction 2. Essentials of Counter-Controlled Repetition 3. For Repetition Statement 4. Examples Using the for Statement 5. Switch Multiple-Selection Statement 6. Do … while Repetition Statement 7. Break and continue Statements 8. Labeled break and continue Statements 9. Logical Operators
  • 3. 1.  Introduction
    • Continuation of Chapter 8
      • Theory and principles of structured programming
  • 4. 2.  Essentials of Counter-Controlled Repetition
    • Counter-controlled repetition
      • Name of a control
      • Initial value
      • Increment or decrement
      • Final value
  • 5. While Counter.html
  • 6. 3.   for Repetition Statement
    • for repetition statement
      • Handles all the details of counter-controlled repetition
      • for structure header
        • The first line
  • 7. 3.   for Repetition Statement for ( var counter=1 ; counter<=7 ; ++counter ) Initial value of control variable Increment control variable Control variable name Final value of control variable for which the condition is true for keyword Loop-continuation condition
  • 8. 3.   for Repetition Statement counter <= 7 document.writeln( &quot;<p style=&quot;font-size: &quot; + counter + &quot;ex&quot;>XHTML font size &quot; + counter + &quot;ex</p>&quot; ); true false var counter = 1 ++counter Establish initial value of control variable. Determine if final value of control variable has been reached. Body of loop (this may be many statements) Increment the control variable. Fig. 9.4 for repetition structure flowchart.
  • 9. For Counter.html
  • 10. 4.  Examples Using the for Statement
    • Summation with for
    • Compound interest calculation with for loop
      • Math object
        • Method pow
        • Method round
  • 11. Sum.html
  • 12. Interest.html
  • 13. 5.   switch Multiple-Selection Statement
    • Controlling expression
    • Case labels
    • Default case
  • 14. SwitchTest.html
  • 15. 5.   switch Multiple-Selection Statement case a case a action(s) true false . . . break case b action(s) break false false case z case z action(s) break default action(s) true true case b
  • 16. 6.   do … while Repetition Statement
    • Similar to the while statement
    • Tests the loop continuation condition after the loop body executes
    • Loop body always executes at least once
  • 17. 6.   do…while Repetition Structure condition true action(s) false Fig. 9.10 do … while repetition statement flowchart.
  • 18. DoWhile.html
  • 19. 7.   break and continue Statements
    • break
      • Immediate exit from the structure
      • Used to escape early from a loop
      • Skip the remainder of a switch statement
    • continue
      • Skips the remaining statements in the body of the structure
      • Proceeds with the next iteration of the loop
  • 20. BreakTest.html
  • 21. ContinueTest.html
  • 22. 8.  Labeled break and continue Statements
    • Labeled break statement
      • Break out of a nested set of structures
      • Immediate exit from that structure and enclosing repetition structures
      • Execution resumes with first statement after enclosing labeled statement
    • Labeled continue statement
      • Skips the remaining statements in structure’s body and enclosing repetition structures
      • Proceeds with next iteration of enclosing labeled repetition structure
      • Loop-continuation test evaluates immediately after the continue statement executes
  • 23. BreakLabelTest.html
  • 24. ContinueLabelTest.html
  • 25. 9.  Logical Operators
    • More logical operators
      • Logical AND ( && )
      • Logical OR ( || )
      • Logical NOT ( ! )
  • 26. 9  Logical Operators
  • 27. 9.  Logical Operators
  • 28. LogicalOperators.html