Browse tutorials by Category - Conditional
Confusing And and Or (BlueJ)
Time: 5:24
|
|
| Average: 166 ratings | Your Rating: |
| 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
|
|
| Average: 182 ratings | Your Rating: |
| 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
|
|
| Average: 190 ratings | Your Rating: |
| 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. |
|
Linear Search of an Array (Eclipse)
Time: 9:08
|
|
| Average: 175 ratings | Your Rating: |
| 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.” |
|
Object Comparison (Eclipse)
Time: 4:15
|
|
| Average: 154 ratings | Your Rating: |
| Categories: Conditional Compile Error Eclipse | |
| Description: click for more...
Demonstrates the use of .equals (dot equals) to compare objects rather than == (Equals equals). The same equality comparison that works for primitives does not work for object types. |
|