The question is in the title.
If I do this in the REPL (SML/NJ in windows commandline)
val x = "hello\nworld";
I'd expect
val x = "hello
world" : string
or something similar, but I get
val x = "hello\nworld" : string
although I found somewhere that \n is a line break in SML strings.
When the string is displayed, the line break is displayed as \n
.
However, if you try printing the string, you'll see it as a proper line break:
- val x = "hello\nworld";
> val x = "hello\nworld" : string
- print x;
hello
world> val it = () : unit
It's simply how the string is displayed, and you cannot make the SML interpreter display it as an actual newline except by printing it yourself.