[Grace-core] finally {return}
James Noble
kjx at ecs.vuw.ac.nz
Tue Jun 23 01:45:28 PDT 2015
> On 23/06/2015, at 20:04pm, Michael Homer <Michael.Homer at ecs.vuw.ac.nz> wrote:
>
> What should this code do?
>> Syntax error: The first line cannot be indented
Hmm. Shouldn’t it print X, then Y, then return 2.
if the finally block was just { y } rather than { return y }
then it should return 1?
What am I missing?
James
> method x {
> print "X"
> return 1
> }
> method y {
> print "Y"
> return 2
> }
> method foo {
> try {
> return x
> } finally {
> return y
> }
> }
> print(foo)
> -Michael
> _______________________________________________
> Grace-core mailing list
> Grace-core at cecs.pdx.edu
> https://mailhost.cecs.pdx.edu/mailman/listinfo/grace-core
More information about the Grace-core
mailing list