开发者

How to printfn int*int*int type

> (1, 2, 3);;
val it : int * int * int = (1, 2, 3)

> printfn "%d" (1, 2 ,3);;

  printfn "%d" (1, 2 ,3);;
  --------------^^^^^^^

stdin(2,15): error FS0001: The type '('a * 'b * 'c)' is not compatible with any of the types byte,int16,int32,int64,sbyt
e,uint16,uint32,uint64,nativeint,unativeint, arising fro开发者_运维技巧m the use of a printf-style format string

How can I printfn this type without creating additional function?


You can print any type with the formatter %A:

printfn "%A" (1, 2, 3);;

Otherwise you will need to unpack your tuple to print it as there are no formatters specific for tuples.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜