为什么一些流行语言中的函数只返回一种类型的结果?
也就是说,我的意思是为什么编译器在遵循以下语法时会出现错误
public int int returnTwoIntegers(){
.......
........
}发布于 2010-07-16 15:30:31
您可以在perl中做到这一点:
sub foo
{
return (10, 20);
}
my ($a, $b) = foo(); # sets $a to 10 and $b to 20以及其他语言中的类似构造。
https://stackoverflow.com/questions/3262627
复制相似问题