"return" in ruby โโis only used if you are trying to return more than one value. eg.
return val1, val2
or if it makes sense to return earlier from the function, for example.
#check if needed param is set return if !param
which is easier than messing up your code with cascading if statements.
Conclusion: use return every time it simplifies your code, or it makes understanding easier.
gorootde
source share