why they have used "bool" instead of box? is it wrong if we put "box"? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

why they have used "bool" instead of box? is it wrong if we put "box"?

20th Feb 2017, 10:42 AM
Gayathree Kaluarachchi
Gayathree Kaluarachchi - avatar
4 Answers
+ 2
It would be a binary option 1 or 0 (true or false), so a boolean was chosen . I may be wrong though
20th Feb 2017, 5:23 PM
Brandon Winger-Air
Brandon Winger-Air - avatar
+ 2
You need to declare the data type that will be returned by the function. In the example, a Box was returned, which is why Box was declared in this case. In the question, a bool is returned, (ie: true or false) which is why bool needs to be declared in this case.
7th Mar 2017, 1:56 PM
Stephen Jukes
+ 2
'Box' is definitly wrong, because the return value is expected. The example in the previous lection is completly misleading...
13th Jan 2019, 6:39 PM
Dennis Hain
Dennis Hain - avatar
0
is a test(> < == != ....) not operation (+ - * /)
21st Feb 2017, 6:17 PM
CEDIRA ABDELAATI
CEDIRA ABDELAATI  - avatar