Int and String F #

I have a function in F # where I take an int value and return an int as a string .

 let inttostring (x:int):string = ""+x 

I cannot get ToString to work. Any help would be appreciated.

+7
source share
1 answer

The empty string "" not compatible with x , which is of type int . you can use

 let int2String x = sprintf "%i" x 

or

 let int2String (x: int) = string x 
+16
source

All Articles