函数的结果是否总是初始化的? [英] Is function's result always initialized?
本文介绍了函数的结果是否总是初始化的?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
类似于此问题,我现在要问以下问题。
Similar to this question, I now ask the following.
function Test:Boolean;
begin end;
结果值始终是否保证为假(0)?不是整数值,布尔值也一样吗?
Is the result value always guranteed to be false(0)? Integer values are not, so are booleans?
推荐答案
否,如果您不初始化值类型函数结果,那么它就是值未定义。可能是False(0),True(1)或其他一些整数值。
No, if you don't initialise a value type function result then it's value is undefined. It could be False (0), True (1), or indeed some other integer value.
您可以用与局部变量相同的方式查看函数返回变量
You can view a function return variable in the same light as a local variable which of course need to be initialized before use.
这个故事的寓意是什么?始终初始化函数的返回值。
The moral of the tale? Always initialize your function return values.
这篇关于函数的结果是否总是初始化的?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文