http://www.perlmonks.org?node_id=1074565


in reply to Re: Hope a subroutine will return undef by default
in thread Hope a subroutine will return undef by default

> what language are you actually trying to mimic here?

At least Javascript comes to mind (update: and Python)

Cheers Rolf

( addicted to the Perl Programming Language)

  • Comment on Re^2: Hope a subroutine will return undef by default

Replies are listed 'Best First'.
Re^3: Hope a subroutine will return undef by default
by qj1020 (Initiate) on Feb 12, 2014 at 22:07 UTC
    You are right, javascript does this. "return ;" in the middle of a function has the same return value as the case when execution of the function goes the end of the function body without a return statement --- both cases return "undefined" or null. No surprises.