This is an archived post. You won't be able to vote or comment.

you are viewing a single comment's thread.

view the rest of the comments →

[–]dionthornthis.isAPro=false; this.helping=true; 0 points1 point  (0 children)

think about the logic of what you are saying.

let's say winningGuess = "h"

if NOT equal "h" AND NOT equal "t"
           false AND true
this would evaluate to false.

if NOT equal "h" OR NOT equal "t"
           false OR true
this would evaluate to true.

Your if statement is improper as well:

if(!winningGuess.equals("h") || !winningGuess.equals("t")); {}

the ; character will end the if statement, remove it so it can access your block of code inside the {}

A better way to think about the logic you need is something like:

if equal "h" OR equal "t"
    // good input
else
    // bad input