1
我不想使用全局值,這對於大型程序來說是危險的。代碼是這樣的如何從子程序返回一個值
subroutine has_key(id)
if (true) then
return 1
else
return 0
end if
end subroutine
subroutine main
if(has_key(id))
write(*,*) 'it works!'
end subroutine
我該怎麼做這樣的子程序。我正在考慮返回一個標誌,但我可能會使用全局值。任何人有想法?
謝謝您的回答返回true!但由於某種原因,我不得不使用子程序的原因是沒有計劃,我嘗試用其他編程語言來連接它。 – Xiao