You are not logged in. Lock_open    

Browse tutorials by Category - Loop

Array, Off By One Error (BlueJ) Time: 7:04 Gb
Average:
  • Currently 3.0/5 Stars from 48 ratings
  •  
  •  
  •  
  •  
  •  
48 ratings
Your Rating:
  • Currently 0.0/5 Stars from 48 ratings
  • 1
  • 2
  • 3
  • 4
  • 5
Categories: Array Loop Logic Error BlueJ
Description: click for more...

This video shows the problem of code that doesn’t produce the correct output because the loop has an off-by-one error when it processes the array to find an average.

Confusing And and Or (BlueJ) Time: 5:24 Gb
Average:
  • Currently 3.0/5 Stars from 55 ratings
  •  
  •  
  •  
  •  
  •  
55 ratings
Your Rating:
  • Currently 0.0/5 Stars from 55 ratings
  • 1
  • 2
  • 3
  • 4
  • 5
Categories: Conditional Loop Logic Error BlueJ
Description: click for more...

This video shows the incorrect uses of || (or) in a compound boolean expression to control a validation loop. The incorrect boolean expression matches with commonly used English “if the user doesn’t answer ‘yes’ or the user doesn’t answer ‘no’ then make them type in another answer.” This expression is complicated by the fact that the “not” is used in conjunction with .equals is harder to parse than, for example, !=.

Incompatible Types (Command Line) Time: 1:33 Gb
Average:
  • Currently 3.2/5 Stars from 67 ratings
  •  
  •  
  •  
  •  
  •  
67 ratings
Your Rating:
  • Currently 0.0/5 Stars from 67 ratings
  • 1
  • 2
  • 3
  • 4
  • 5
Categories: Conditional Compile Error Loop Command Line
Description: click for more...

What to do when you see an incompatible types compiler error in a loop condition or in the condition of an if statement.

Shows the effect of using equals (=) instead of equalsequals (==), causing an assignment when you intend to have a equality comparison.

Incompatible Types (Eclipse) Time: 1:05 Gb
Average:
  • Currently 3.1/5 Stars from 61 ratings
  •  
  •  
  •  
  •  
  •  
61 ratings
Your Rating:
  • Currently 0.0/5 Stars from 61 ratings
  • 1
  • 2
  • 3
  • 4
  • 5
Categories: Conditional Compile Error Loop Eclipse
Description: click for more...

What to do when you see an incompatible types compiler error in a loop condition or in the condition of an if statement.

Shows the effect of using equals (=) instead of equalsequals (==), causing an assignment when you intend to have a equality comparison.

Infinite Loop (BlueJ) Time: 6:41 Gb
Average:
  • Currently 3.1/5 Stars from 62 ratings
  •  
  •  
  •  
  •  
  •  
62 ratings
Your Rating:
  • Currently 0.0/5 Stars from 62 ratings
  • 1
  • 2
  • 3
  • 4
  • 5
Categories: Loop Logic Error Debugging Process BlueJ
Description: click for more...

Shows an infinite loop that occurs due to lack of update of a loop iterator inside an if statement in the loop. It identifies that an infinite loop is happening when the program does not seem to end. It then shows how to insert print statements to output the iterator value at the beginning of the loop, and then again at the end of the loop.

Infinite Loop (Eclipse) Time: 5:09 Gb
Average:
  • Currently 3.1/5 Stars from 49 ratings
  •  
  •  
  •  
  •  
  •  
49 ratings
Your Rating:
  • Currently 0.0/5 Stars from 49 ratings
  • 1
  • 2
  • 3
  • 4
  • 5
Categories: Loop Logic Error Debugging Process Eclipse
Description: click for more...

Shows an infinite loop that occurs due to lack of update of a loop iterator inside an if statement in the loop. It identifies that an infinite loop is happening when the program does not seem to end. It then shows how to insert print statements to output the iterator value at the beginning of the loop, and then again at the end of the loop.

Linear Search of an Array (Eclipse) Time: 9:08 Gb
Average:
  • Currently 3.1/5 Stars from 50 ratings
  •  
  •  
  •  
  •  
  •  
50 ratings
Your Rating:
  • Currently 0.0/5 Stars from 50 ratings
  • 1
  • 2
  • 3
  • 4
  • 5
Categories: Conditional Array Loop Logic Error Debugging Process Eclipse
Description: click for more...

This video shows a program which is searching through an array, in a linear fashion, looking for a value. It has an if…else statement within a loop which assigns a boolean value to a variable called “found” every iteration of the loop (if theArray[index] == value). It shows that the code works for any value not in the array, but that it always reports “found” to be false, even for values that are in the array. By inserting print statements at the start of the if block and then in the else block, it shows that “found” is updated every iteration of the loop, potentially overwriting the assignment of true to “found.”

Missing Input Statement (BlueJ) Time: 3:12 Gb
Average:
  • Currently 3.1/5 Stars from 50 ratings
  •  
  •  
  •  
  •  
  •  
50 ratings
Your Rating:
  • Currently 0.0/5 Stars from 50 ratings
  • 1
  • 2
  • 3
  • 4
  • 5
Categories: Loop Logic Error BlueJ
Description: click for more...

This video shows an infinite loop that occurs due to a lack of an input statement inside a validation loop. A prompt and a scan is used before the loop, but the code inside the loop only has a prompt. It points out the infinite loop and shows the addition of a read statement to fix the problem.

While Loop Doesn't Execute (Command Line) Time: 2:20 Gb
Average:
  • Currently 3.1/5 Stars from 44 ratings
  •  
  •  
  •  
  •  
  •  
44 ratings
Your Rating:
  • Currently 0.0/5 Stars from 44 ratings
  • 1
  • 2
  • 3
  • 4
  • 5
Categories: Array Loop Logic Error Command Line
Description: click for more...

While loop that either loops continually and never stops, appears to execute once, or doesn’t execute at all.

While-snurra exekveras inte (kommandorad) Time: 7:14 Se
Average:
  • Currently 3.0/5 Stars from 40 ratings
  •  
  •  
  •  
  •  
  •  
40 ratings
Your Rating:
  • Currently 0.0/5 Stars from 40 ratings
  • 1
  • 2
  • 3
  • 4
  • 5
Categories: Array Loop Logic Error Command Line
Description: click for more...

Visar på ett program som tycks hänga sig när man kör det. Videon visar hur man använda sig av olika spårutskrifter för att försöka isolera felet.