+ 3
Return bool or 1/0
What would be the correct (or more efficient) way to return a value of a function?
2 odpowiedzi
+ 5
If you just need true or false then use bool.
Bool takes 1 byte, while int uses 4.
Doesn't make that much difference in efficiency on most systems, but it also makes your code more readable in my opinion.
+ 14
most programming languages use boolean, but for example in C you don't have boolean so you can use 1 for true and 0 for false