Return Result Directly? Or Store in in a Variable?

Опубликовано: 16 Июль 2026
на канале: CSExplained
264
8

Oftentimes, I've seen code where people save the result of method call, and then return that saved value... Is that necessary? In my opinion, it depends. If you are going to do something with it, then yes, it would probably make sense to store that into a variable to make the code easier to understand. If however, you are not doing anything with it, then it is better to just return result directly without having to store it in a variable...

#shorts