Beefy Boxes and Bandwidth Generously Provided by pair Networks
Do you know where your variables are?
 
PerlMonks  

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

by LanX (Canon)
on Feb 12, 2014 at 01:00 UTC ( #1074565=note: print w/ replies, xml ) Need Help??


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
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.

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://1074565]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others drinking their drinks and smoking their pipes about the Monastery: (10)
As of 2014-12-27 12:45 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    Is guessing a good strategy for surviving in the IT business?





    Results (177 votes), past polls