Announcement

Collapse
No announcement yet.

Function's: return a & return (a)

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • Function's: return a & return (a)

    Hi,
    I'm a little confused about the "return" statement in functions. On page 32 the Programmers Reference Manual Rev2, an example showed:
    HTML Code:
    z := x + y;return z;
    Then at the bottom, another example showed:
    
    return (total);
    Are they actually the same? "return a" and "return (a)" both sends value of variable "a" back to the caller?
    Thanks.

  • #2


    Parenthesis around the return value are optional in 4DGL.
    They are often used to neaten the code.
    Sometimes they might be necessary, eg:-

    return ((a+b)*c);

    which looks better than:-

    return (a+b) * c;

    ... and of course

    return a+b*c; would not return what you may expect.
    Regards,
    Dave

    Comment


    • #3


      Got it. Thanks Dave.

      Comment

      Working...
      X