Welcome to the CSC Q&A.
Get help and give help!
Write great code!
It is our choices... that show what we truly are, far more than our abilities.

Categories

+15 votes

In boolean methods, do they always have to return either true or false or is there other things that are possible to be returned from these methods?

asked in CSC211_Winter2018 by (8 points)

2 Answers

+10 votes

Boolean results are used to determine whether a condition is true or false, and allow us to write programs that decide whether to execute some code or not. Therefore they do not have any other possible return statements other than true or false.

answered by (8 points)
+8 votes

Jason is exactly correct. A boolean value can only be true or false. That's it. Whether a boolean value is returned from a method or a variable is created of type boolean, the only possible values are true or false.

answered by (524 points)
...