Reusing function variables in a `when` conditional

I was imagining something like foo = ^foo + 1 which would reference the variable in the outer scope. Or is foo destroyed when it leave scope?