2017-07-26 53 views
-2

在TCL過程結束時,返回和返回1之間是否有區別?在tcl的proc結束時,返回和返回1之間有任何區別嗎?TCL過程中返回和返回1之間的區別

+0

'return'等於'返回None' –

+0

@KlausD:沒有,'返回None'返回'None',它不等於空字符串'return'返回。 –

+0

@PeterLewerin可能是一個誤解,這個問題最初被標記爲Python。 –

回答

2

Tcl return命令將簡單地返回空字符串,如果您不告訴它返回其他任何東西。這三個都是完全等同:

return 
return "" 
return {} 

顯然,return 1是另一回事。

1

「return」return none。 這什麼都不顯示:

#!/usr/bin/tclsh 

proc helloWorld {} { 
    return 
} 
puts [helloWorld] 

「返回1」 返回值1。 該顯示器1:

#!/usr/bin/tclsh 

proc helloWorld {} { 
    return 1 
} 
puts [helloWorld] 
相關問題