A Return inside and outside an If Statement

前端 未结 2 1585
醉梦人生
醉梦人生 2021-02-10 01:53

This is probably a fairly easy question to answer, but it has been bugging me some time.

If there is a return statement inside an if statement, inside a method (in the J

2条回答
  •  滥情空心
    2021-02-10 02:43

    Only the first return statement hit is used. The method then terminates.

    There are some code conventions that frown on multiple return statements because they might be hard to read, but I'm not one of them. :)

提交回复
热议问题