On Thursday 21 November 2013 18:39:09 Marcos Douglas wrote:
> On Thu, Nov 21, 2013 at 1:27 PM, Martin Schreiber <[email protected]> 
wrote:
>
> Why needs a 'return' statement only before 'end'?

Not only, before end must be a return statement otherwise the return value is 
undefined.

> Using 'return' this will be valid?
> sub sum(a: int, b: int): int;
> begin
>   if (a = 0) or (b = 0)
>     return 0
>   end;
>
>   return a+b;
> end;
>
Yes.

> Why 'return' statement before 'end;' is ugly too?
>

Your example shows it, the first 'return' is an independent statement, the 
second is glued to 'end'. The thought is, if it is glued to end, why not make 
it right and show the glue by the ':=' operator?

Martin

------------------------------------------------------------------------------
Shape the Mobile Experience: Free Subscription
Software experts and developers: Be at the forefront of tech innovation.
Intel(R) Software Adrenaline delivers strategic insight and game-changing 
conversations that shape the rapidly evolving mobile landscape. Sign up now. 
http://pubads.g.doubleclick.net/gampad/clk?id=63431311&iu=/4140/ostg.clktrk
_______________________________________________
mseide-msegui-talk mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/mseide-msegui-talk

Reply via email to