0
以下兩個表達式產生相同的輸出:string.length減和連接的字符串
> ("hello" + " " + "world!");;
val it : string = "hello world!"
> "hello" + " " + "world!";;
val it : string = "hello world!"
那麼爲什麼String.length
作品與第一,但不是第二個?
> String.length ("hello" + " " + "world!");;
val it : int = 12
> String.length "hello" + " " + "world!";;
String.length "hello" + " " + "world!";;
------------------------^^^
stdin(57,25): error FS0001: The type 'string' does not match the type 'int'
將其上FSI 14.0.22214.0