7/19 Implicit vs Explicit


#1

After researching for an hour, I still can not wrap my head around using implicit return vs. using explicit return.
Why would I want to use explicit return when it exits out of of a method right away? I know explicit return returns a value but why would I want a value returned when I can just print or puts the output to the console? Am I understanding this correctly? I need help understanding because I don’t see why explicit return would be favored over just waiting till the last line of a method to output a result.


#2

It is possible to return from any place in a function, not just the last line. These would be conditional returns. We can get away without using the return keyword but in cases such as this, explicit returns will help the reader to see them.


#3

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.