in reply to 'return:' instead of 'return'
Does the label get evaluated at all?Labels never get "evaluated".
Given that 'return' does little other than declare the end of the subroutine, is there really anything wrong with his usage?'return' (as a statement) doesn't declare the end of a subroutine, it's just a way to exit the subroutine. You can have a return statement halfway the subroutine. Whether there's something "wrong" depends on what you mean by it. If 'fn' is supposed to return '3', then it will, regardless whether the label is there. But this is not a general return statement.
is not going to return 3. It will return 2. So it that sense, the use to 'return:' is wrong.sub fn { if (1) { return: 3 } 2 }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: 'return:' instead of 'return'
by Boldra (Curate) on Jun 12, 2009 at 09:45 UTC | |
by JavaFan (Canon) on Jun 12, 2009 at 09:54 UTC | |
by Boldra (Curate) on Jun 12, 2009 at 10:41 UTC | |
by jethro (Monsignor) on Jun 12, 2009 at 11:04 UTC | |
by Boldra (Curate) on Jun 12, 2009 at 11:58 UTC | |
| |
by JavaFan (Canon) on Jun 12, 2009 at 12:10 UTC | |
by Boldra (Curate) on Jun 12, 2009 at 12:21 UTC | |
| |
by ikegami (Patriarch) on Jun 12, 2009 at 16:30 UTC |