Beefy Boxes and Bandwidth Generously Provided by pair Networks
Clear questions and runnable code
get the best and fastest answer
 
PerlMonks  

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

by LanX (Chancellor)
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

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.

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://1074565]
help
Chatterbox?
[erix]: infallibility breeds inquisition
[erix]: ( hm. that doesn't make sense really -- infallibility is a 19th century invention, the Inquisition quite a bit earlier )

How do I use this? | Other CB clients
Other Users?
Others drinking their drinks and smoking their pipes about the Monastery: (5)
As of 2017-01-17 23:56 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    Do you watch meteor showers?




    Results (159 votes). Check out past polls.