1 / 3

Computer Science

Computer Science. Errors & Debugging Structures & Loops. Avoiding Errors with if statements. Floating points are not good test values especially if you are using them for comparison Don’t forget to enclose Blocks of code in Brace brackets { }

milica
Download Presentation

Computer Science

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Computer Science Errors & Debugging Structures & Loops

  2. Avoiding Errors with if statements • Floating points are not good test values especially if you are using them for comparison • Don’t forget to enclose Blocks of code in • Brace brackets { } • Use the comparison operator == in if statements not the assignment operator = • Initialize values in if statements to take into account all eventualities • Use boolean operators correctly to combine conditions

  3. Avoiding errors with loops • For a counted loop use for • For a pre-test conditional loop use while • For a post-test conditional loop use do • For a counting and condition loop use for • Initialize all variables • Watch for infinite loops • Use boolean operators correctly to combine conditions

More Related