Concatenate lines in okamla with a new line in between

I would like to do something like this

String.concat '\n' [str1; str2 ... strn]

      

so i can print to file. But the okaml does not allow me to do this. What can I do?

+3


source to share


1 answer


String.concat "\n" [str1; str2 ... strn]

      

works great. The problem is what you used '\n'

, which is a character literal, not a string. Example:



# String.concat '\n' ["abc"; "123"];;
Error: This expression has type char but an expression was expected of type
     string
# String.concat "\n" ["abc"; "123"];;
- : string = "abc\n123"

      

+8


source







All Articles