[prev in list] [next in list] [prev in thread] [next in thread]
List: gambas-user
Subject: Re: [Gambas-user] When you use RETURN the FINALLY block not start
From: Jussi Lahtinen <jussi.lahtinen () gmail ! com>
Date: 2010-04-25 12:43:09
Message-ID: j2p384d3901004250543zf50b17d4jf9d652b9ad0fa105 () mail ! gmail ! com
[Download RAW message or body]
Little bit of topic but:
SUB F1() AS Integer
Shouldn't this be FUNCTION?
I didn't know subs can return value.
New to me...
Jussi
2010/4/25 Benoît Minisini <gambas@users.sourceforge.net>:
>> Code:
>> ' Gambas module file
>>
>> PUBLIC SUB Main()
>> PRINT F1()
>> PRINT F2()
>> PRINT "END"
>> END
>>
>> SUB F1() AS Integer
>> PRINT "F1"
>> FINALLY
>> PRINT "F1-FIANLLY"
>> END
>>
>> SUB F2() AS Integer
>> PRINT "F2"
>> RETURN 2
>> FINALLY
>> PRINT "F2-FIANLLY"
>> END
>>
>> Output:
>> F1
>> F1-FINALLY
>> 0
>> F2
>> 2
>> END
>>
>> bug or a feature?
>>
>
> Feature ! RETURN is stronger than anything. You must put it inside the FINALLY
> block.
>
> Regards,
>
> --
> Benoît Minisini
>
> ------------------------------------------------------------------------------
> _______________________________________________
> Gambas-user mailing list
> Gambas-user@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/gambas-user
>
------------------------------------------------------------------------------
_______________________________________________
Gambas-user mailing list
Gambas-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/gambas-user
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic