Fortran返回语句过时了吗? [英] Is Fortran return statement obsolete?

查看:169
本文介绍了Fortran返回语句过时了吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我只是想知道Fortran 2008中的return语句是否已过时,因为似乎没有必要在子例程和函数的末尾编写它.

I just want to know if the return statement in Fortran 2008 is obsolete, because it seems to be unnecessary to write it at the end of subroutines and functions.

它还有其他实用程序吗?

Does it have some other utility?

推荐答案

不,它不是过时的.

它用于退出子例程和函数.每当要在子例程的中间退出时,请使用RETURN.例如,当发生某些错误或类似错误时.

It is used to exit a subroutine and a function. Whenever you want to exit in the middle of a subroutine, you use RETURN. For example, when some error happens or similar.

如果条件类似,

if (no_error) then




   a lot of code




 end if

你只是做

 if (error) return

 a lot of code

这篇关于Fortran返回语句过时了吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆