Ranter
Join devRant
Do all the things like
++ or -- rants, post your own rants, comment on others' rants and build your customized dev avatar
Sign Up
Pipeless API
From the creators of devRant, Pipeless lets you power real-time personalized recommendations and activity feeds using a simple API
Learn More
Comments
-
lotd77757yWhen parsing bools extern or input, I oftentimes cast to a string and check it's equal to "true". As a guarding measure.
Internally when I don't need to be strict, I oftentimes just defer to evaluate it's truthy, as it's a bit more flexible.
- I might make it strict on a later refactor step though. -
At work we like to keep it as simple as possible, but also as readable.
So if(condition === true) is what I use -
If(condition) if the program is small and isn't used much.
This way I know for definite it won't return Null or anything like that
Related Rants
Which one are you?
joke/meme
boolean
coding
android studio
java