It looks like you're new here. If you want to get involved, click one of these buttons!
So what does this mean ?
return answer == y;
I am not entirely sure of its meaning any help is appreciated
return statement tells a function to return execution of the program to the calling function, and report the value.
In your situation the return value will be either true or false.
Think of it like this in pseudo-code:
return (is the answer equal to y) //yes = true; no = false
then you can break it down:
return (the answer equal to y)
return (answer equal to y)
return answer == y
Most logic is done through conditional statements. Something that can be seemingly perplexing at first, but consider a switch statement:
is the same as if value == 1, if value ==2, if value == 3
If statements are the same if(10 > 5) dosomething(); // is 10 greater than 5? true
Even these are implementations of conditional statements:
return x == 5 ? x : 0; // if x is equal to 5 send back x; if x is NOT equal to 5 send back 0