Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Int and String F# [closed]

Tags:

string

int

f#

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

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

I can't get ToString to work. Any help would be appreciated.

like image 807
user1090614 Avatar asked Aug 30 '12 17:08

user1090614


1 Answers

Empty string "" isn't compatible with x which is of int type. You can use

let int2String x = sprintf "%i" x

or

let int2String (x: int) = string x
like image 80
pad Avatar answered Oct 22 '22 06:10

pad