473,387 Members | 1,504 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

function return values

If I assign a variable to a function, say,
$x = f($y);
and then f happens not to return anything, does $x just remain unset? Or is
this illegal?
Jul 17 '05 #1
5 2243
"sinister" <si******@nospam.invalid> writes:
If I assign a variable to a function, say,
$x = f($y);
and then f happens not to return anything, does $x just remain unset? Or is
this illegal?


What happened when you tried it?

--
Michael Fuhr
http://www.fuhr.org/~mfuhr/
Jul 17 '05 #2

"Michael Fuhr" <mf***@fuhr.org> wrote in message
news:3f**********@omega.dimensional.com...
"sinister" <si******@nospam.invalid> writes:
If I assign a variable to a function, say,
$x = f($y);
and then f happens not to return anything, does $x just remain unset? Or is this illegal?
What happened when you tried it?

<omission of laziness>Haven't.</omission of laziness>

--
Michael Fuhr
http://www.fuhr.org/~mfuhr/

Jul 17 '05 #3

"sinister" <si******@nospam.invalid> wrote in message
news:Bi******************@nwrddc03.gnilink.net...

"Michael Fuhr" <mf***@fuhr.org> wrote in message
news:3f**********@omega.dimensional.com...
"sinister" <si******@nospam.invalid> writes:
If I assign a variable to a function, say,
$x = f($y);
and then f happens not to return anything, does $x just remain unset? Or is this illegal?
What happened when you tried it?

<omission of laziness>Haven't.</omission of laziness>


Of course, that should read <admission ...>

One reason I wanted to ask, not just test, is that I couldn't find the
answer in documentation, and there's always the danger that one
instantiation of the language will do it one way, and another another way.

--
Michael Fuhr
http://www.fuhr.org/~mfuhr/


Jul 17 '05 #4
No. $x would return NULL

"sinister" <si******@nospam.invalid> wrote in message
news:mP*****************@nwrddc03.gnilink.net...
If I assign a variable to a function, say,
$x = f($y);
and then f happens not to return anything, does $x just remain unset? Or is this illegal?

Jul 17 '05 #5
Couldn't f() return NULL when it does not specifically returns something else?

"Michel" <pl*******@spam.nl> wrote in message news:<bp**********@news.cistron.nl>...
No. $x would return NULL

"sinister" <si******@nospam.invalid> wrote in message
news:mP*****************@nwrddc03.gnilink.net...
If I assign a variable to a function, say,
$x = f($y);
and then f happens not to return anything, does $x just remain unset? Or

is
this illegal?

Jul 17 '05 #6

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

9
by: Penn Markham | last post by:
Hello all, I am writing a script where I need to use the system() function to call htpasswd. I can do this just fine on the command line...works great (see attached file, test.php). When my...
8
by: Nick Coghlan | last post by:
Time for another random syntax idea. . . So, I was tinkering in the interactive interpreter, and came up with the following one-size-fits-most default argument hack: Py> x = 1 Py> def...
8
by: Tweaxor | last post by:
Hey, I was trying to figure out was it possible in C to pass the values in an array from one function to another function. Is the possible in C? ex. y is the array that holds seven values If...
14
by: Mr Newbie | last post by:
I am often in the situation where I want to act on the result of a function, but a simple boolean is not enough. For example, I may have a function called isAuthorised ( User, Action ) as ?????...
4
by: Tony Lownds | last post by:
(Note: PEPs in the 3xxx number range are intended for Python 3000) PEP: 3107 Title: Function Annotations Version: $Revision: 53169 $ Last-Modified: $Date: 2006-12-27 20:59:16 -0800 (Wed, 27 Dec...
6
by: srini4vasan | last post by:
Hi, Is that possible to return two values from a functions at a time. ie.,Can a function return two values at a time. if() { return } else
11
by: aarklon | last post by:
Hi all, I have heard many discussions among my colleagues that main is a user defined function or not. arguments in favour:- 1) if it is built in function it must be defined in some header...
4
by: barcaroller | last post by:
I am trying to adopt a model for calling functions and checking their return values. I'm following Scott Meyer's recommendation of not over-using exceptions because of their potential overhead. ...
2
ADezii
by: ADezii | last post by:
The incentive for this Tip was an Article by the amazing Allen Browne - I considered it noteworthy enough to post as The Tip of the Week in this Access Forum. Original Article by Allen Browne ...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.