function return values

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • sinister

    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?


  • Michael Fuhr

    #2
    Re: function return values

    "sinister" <sinister@nospa m.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

    Comment

    • sinister

      #3
      Re: function return values


      "Michael Fuhr" <mfuhr@fuhr.org > wrote in message
      news:3fb8e3ed$1 _2@omega.dimens ional.com...[color=blue]
      > "sinister" <sinister@nospa m.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]


      Comment

      • sinister

        #4
        Re: function return values


        "sinister" <sinister@nospa m.invalid> wrote in message
        news:Bi6ub.5241 1$n6.36338@nwrd dc03.gnilink.ne t...[color=blue]
        >
        > "Michael Fuhr" <mfuhr@fuhr.org > wrote in message
        > news:3fb8e3ed$1 _2@omega.dimens ional.com...[color=green]
        > > "sinister" <sinister@nospa m.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]


        Comment

        • Michel

          #5
          Re: function return values

          No. $x would return NULL



          "sinister" <sinister@nospa m.invalid> wrote in message
          news:mP4ub.5209 8$n6.1079@nwrdd c03.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]


          Comment

          • pouzzler

            #6
            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$l8 k$1@news.cistro n.nl>...[color=blue]
            > No. $x would return NULL
            >
            >
            >
            > "sinister" <sinister@nospa m.invalid> wrote in message
            > news:mP4ub.5209 8$n6.1079@nwrdd c03.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]

            Comment

            Working...