gpt4 book ai didi

perl - "last"函数运算符?

转载 作者:行者123 更新时间:2023-12-04 16:36:31 24 4
gpt4 key购买 nike

Perl 是否有退出函数或 last 的操作符?对于函数?

sub f {

# some code here

if ($v == 10) {
# goto end of function/exit function/last
}

# some code here
}

一个 goto可以做到这一点,但不知何故它接缝错了?

最佳答案

使用 return;退出子程序。

关于perl - "last"函数运算符?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/5538237/

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