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
-
P3t3r66608yWell... One thing's for sure... From now on you'll have a lot of great material to post on devRant 😂
-
orijin20218yWHILE this isn't funny, IF pm gets hit by a bus: celebrate! ELSE keep calling him an idiot.
-
Lukas18728yKeep us updated on his further higher informatical insights. This is going to be an interesting one :)
-
trueter498yDepending on language and environment I can see his actually making sense. Putting a focus on functional paradigms instead of imperatives constructs can result in more resilient code.
-
Lukas18728y...though I must admit: you can perfectly work without else. First set the value and only change it if the condition is met.
-
@Lukas and if you want to do two different function calls depending on a condition?
-
Lukas18728ydynamic calling: but that's not possible in every language. Save the methode name in a string and the 'execute the string content'....other solution: case/switch...and this one is very elegant in OO: strategy pattern.
-
mcraz16768yActually I too try to avoid if else IF I CAN. I always try to structure code in a way to eliminate conditions with IF and then have my else code after that.
Looks clean. But at times, you just can't live without if/else. -
call-a32368y@P3t3r6 and @Lukas You van also do tail recursion with a check for the stop-condition at the top: doOneStep(...params) {if (stop-condition) return; do-stuff; return doOneStep(... params-for-next-step);}
-
Guess I'm lucky as mine encourages the use of Do While, as long as it's appropriate and the right approach.
Related Rants
Started a new job this week.
Just learned that my manager strictly prohibits while loops and "if else" statements.
undefined
what