Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

关于 "try里面的return 和 finally的return" #1588

Closed
yydzxz opened this issue Mar 1, 2022 · 3 comments
Closed

关于 "try里面的return 和 finally的return" #1588

yydzxz opened this issue Mar 1, 2022 · 3 comments
Labels
enhancement New feature or request or suggestion

Comments

@yydzxz
Copy link

yydzxz commented Mar 1, 2022

image
try里面的return是会执行的,只不过最终的返回值由finally里面的return决定
image

@yydzxz
Copy link
Author

yydzxz commented Mar 1, 2022

有相关的issue #190

@hujesse83
Copy link
Contributor

try 只是调用了print方法. 等价于
int res = print("我是try块里面的"); return res;

@Snailclimb
Copy link
Owner

image try里面的return是会执行的,只不过最终的返回值由finally里面的return决定 image

感谢指出,我之前的描述确实不严谨,已经修改👍

image

@Snailclimb Snailclimb added the enhancement New feature or request or suggestion label Mar 3, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request or suggestion
Projects
None yet
Development

No branches or pull requests

3 participants