Your SlideShare is downloading. ×
0
Kelompok 8 Pbw
Kelompok 8 Pbw
Kelompok 8 Pbw
Kelompok 8 Pbw
Kelompok 8 Pbw
Kelompok 8 Pbw
Kelompok 8 Pbw
Kelompok 8 Pbw
Kelompok 8 Pbw
Kelompok 8 Pbw
Kelompok 8 Pbw
Kelompok 8 Pbw
Kelompok 8 Pbw
Kelompok 8 Pbw
Kelompok 8 Pbw
Kelompok 8 Pbw
Kelompok 8 Pbw
Kelompok 8 Pbw
Kelompok 8 Pbw
Kelompok 8 Pbw
Kelompok 8 Pbw
Kelompok 8 Pbw
Kelompok 8 Pbw
Kelompok 8 Pbw
Kelompok 8 Pbw
Kelompok 8 Pbw
Kelompok 8 Pbw
Kelompok 8 Pbw
Upcoming SlideShare
Loading in...5
×

Thanks for flagging this SlideShare!

Oops! An error has occurred.

×
Saving this for later? Get the SlideShare app to save on your phone or tablet. Read anywhere, anytime – even offline.
Text the download link to your phone
Standard text messaging rates apply

Kelompok 8 Pbw

231

Published on

Published in: Technology
0 Comments
0 Likes
Statistics
Notes
  • Be the first to comment

  • Be the first to like this

No Downloads
Views
Total Views
231
On Slideshare
0
From Embeds
0
Number of Embeds
1
Actions
Shares
0
Downloads
1
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 <ul><li>Continuation of Chapter 8 </li></ul><ul><ul><li>Theory and principles of structured programming </li></ul></ul>
  • 4. 2.  Essentials of Counter-Controlled Repetition <ul><li>Counter-controlled repetition </li></ul><ul><ul><li>Name of a control </li></ul></ul><ul><ul><li>Initial value </li></ul></ul><ul><ul><li>Increment or decrement </li></ul></ul><ul><ul><li>Final value </li></ul></ul>
  • 5. While Counter.html
  • 6. 3.   for Repetition Statement <ul><li>for repetition statement </li></ul><ul><ul><li>Handles all the details of counter-controlled repetition </li></ul></ul><ul><ul><li>for structure header </li></ul></ul><ul><ul><ul><li>The first line </li></ul></ul></ul>
  • 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 <ul><li>Summation with for </li></ul><ul><li>Compound interest calculation with for loop </li></ul><ul><ul><li>Math object </li></ul></ul><ul><ul><ul><li>Method pow </li></ul></ul></ul><ul><ul><ul><li>Method round </li></ul></ul></ul>
  • 11. Sum.html
  • 12. Interest.html
  • 13. 5.   switch Multiple-Selection Statement <ul><li>Controlling expression </li></ul><ul><li>Case labels </li></ul><ul><li>Default case </li></ul>
  • 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 <ul><li>Similar to the while statement </li></ul><ul><li>Tests the loop continuation condition after the loop body executes </li></ul><ul><li>Loop body always executes at least once </li></ul>
  • 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 <ul><li>break </li></ul><ul><ul><li>Immediate exit from the structure </li></ul></ul><ul><ul><li>Used to escape early from a loop </li></ul></ul><ul><ul><li>Skip the remainder of a switch statement </li></ul></ul><ul><li>continue </li></ul><ul><ul><li>Skips the remaining statements in the body of the structure </li></ul></ul><ul><ul><li>Proceeds with the next iteration of the loop </li></ul></ul>
  • 20. BreakTest.html
  • 21. ContinueTest.html
  • 22. 8.  Labeled break and continue Statements <ul><li>Labeled break statement </li></ul><ul><ul><li>Break out of a nested set of structures </li></ul></ul><ul><ul><li>Immediate exit from that structure and enclosing repetition structures </li></ul></ul><ul><ul><li>Execution resumes with first statement after enclosing labeled statement </li></ul></ul><ul><li>Labeled continue statement </li></ul><ul><ul><li>Skips the remaining statements in structure’s body and enclosing repetition structures </li></ul></ul><ul><ul><li>Proceeds with next iteration of enclosing labeled repetition structure </li></ul></ul><ul><ul><li>Loop-continuation test evaluates immediately after the continue statement executes </li></ul></ul>
  • 23. BreakLabelTest.html
  • 24. ContinueLabelTest.html
  • 25. 9.  Logical Operators <ul><li>More logical operators </li></ul><ul><ul><li>Logical AND ( && ) </li></ul></ul><ul><ul><li>Logical OR ( || ) </li></ul></ul><ul><ul><li>Logical NOT ( ! ) </li></ul></ul>
  • 26. 9  Logical Operators
  • 27. 9.  Logical Operators
  • 28. LogicalOperators.html

×