gpt4 book ai didi

pascal - 在 Pascal 中返回一个值

转载 作者:行者123 更新时间:2023-12-04 02:00:17 33 4
gpt4 key购买 nike

对于在 Pascal 中返回值的函数,赋值 FunctionName := SomeVal;用来。我认为它不会像 return 那样在那个确切的地方停止函数执行在 C 中。有没有类似C的东西return在帕斯卡? (我正在使用 FreePascal 编译器)

最佳答案

您可以使用退出过程。

function Foo (Value : integer) : Integer;
begin
Exit(Value*2);
DoSomethingElse(); // This will never execute
end;

关于pascal - 在 Pascal 中返回一个值,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/9641652/

33 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com