Connecting Tech Pros Worldwide Help | Site Map

function return values

  #1  
Old July 17th, 2005, 02:10 AM
sinister
Guest
 
Posts: n/a
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?


  #2  
Old July 17th, 2005, 02:10 AM
Michael Fuhr
Guest
 
Posts: n/a

re: function return values


"sinister" <sinister@nospam.invalid> writes:
[color=blue]
> 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?[/color]

What happened when you tried it?

--
Michael Fuhr
http://www.fuhr.org/~mfuhr/
  #3  
Old July 17th, 2005, 02:10 AM
sinister
Guest
 
Posts: n/a

re: function return values



"Michael Fuhr" <mfuhr@fuhr.org> wrote in message
news:3fb8e3ed$1_2@omega.dimensional.com...[color=blue]
> "sinister" <sinister@nospam.invalid> writes:
>[color=green]
> > 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?[/color][/color]
Or is[color=blue][color=green]
> > this illegal?[/color]
>
> What happened when you tried it?[/color]
<omission of laziness>Haven't.</omission of laziness>
[color=blue]
>
> --
> Michael Fuhr
> http://www.fuhr.org/~mfuhr/[/color]


  #4  
Old July 17th, 2005, 02:10 AM
sinister
Guest
 
Posts: n/a

re: function return values



"sinister" <sinister@nospam.invalid> wrote in message
news:Bi6ub.52411$n6.36338@nwrddc03.gnilink.net...[color=blue]
>
> "Michael Fuhr" <mfuhr@fuhr.org> wrote in message
> news:3fb8e3ed$1_2@omega.dimensional.com...[color=green]
> > "sinister" <sinister@nospam.invalid> writes:
> >[color=darkred]
> > > 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?[/color][/color]
> Or is[color=green][color=darkred]
> > > this illegal?[/color]
> >
> > What happened when you tried it?[/color]
> <omission of laziness>Haven't.</omission of laziness>[/color]

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.
[color=blue]
>[color=green]
> >
> > --
> > Michael Fuhr
> > http://www.fuhr.org/~mfuhr/[/color]
>
>[/color]


  #5  
Old July 17th, 2005, 02:10 AM
Michel
Guest
 
Posts: n/a

re: function return values


No. $x would return NULL



"sinister" <sinister@nospam.invalid> wrote in message
news:mP4ub.52098$n6.1079@nwrddc03.gnilink.net...[color=blue]
> 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[/color]
is[color=blue]
> this illegal?
>
>[/color]


  #6  
Old July 17th, 2005, 02:12 AM
pouzzler
Guest
 
Posts: n/a

re: function return values


Couldn't f() return NULL when it does not specifically returns something else?



"Michel" <please_no@spam.nl> wrote in message news:<bparsq$l8k$1@news.cistron.nl>...[color=blue]
> No. $x would return NULL
>
>
>
> "sinister" <sinister@nospam.invalid> wrote in message
> news:mP4ub.52098$n6.1079@nwrddc03.gnilink.net...[color=green]
> > 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[/color]
> is[color=green]
> > this illegal?
> >
> >[/color][/color]
Closed Thread


Similar Threads
Thread Thread Starter Forum Replies Last Post
How to delete arrays that are passed as function return values? Oliver Graeser answers 9 August 22nd, 2008 12:25 PM
Function return values... barcaroller answers 4 June 27th, 2008 05:35 PM
Function return values revisited guy answers 6 November 20th, 2005 10:20 PM
non-const function return values: gcc bug or language flaw? Christian Engström answers 19 July 22nd, 2005 07:26 AM