+ 7

why return true or return false?

why some one use return true or false in method

25th Oct 2017, 2:46 PM
wachirut chaiwong
wachirut chaiwong - avatar
2 Antworten
+ 32
just for know that a required condition is true or not //for example for knowing a number is prime or not , we can use boolean type in the method for checking prime //hope it helps ☺
25th Oct 2017, 2:49 PM
Gaurav Agrawal
Gaurav Agrawal - avatar
+ 4
I like using true or false returns for the result of a method checking validity of data or testing a condition. boolean isLeapYear(int year); boolean checkDate(int month, int day, int year);
25th Oct 2017, 2:52 PM
John Wells
John Wells - avatar