How can I write multiline strings in Haskell? -
let's have string literal line breaks:
file :: string file = "the first line\nthe second line\nthe third line"
is there way write this?
file :: string file = "the first line second line third line"
the attempt above leads error:
factor.hs:58:33: lexical error in string/character literal @ character '\n' failed, modules loaded: none.
you can write multiline strings so
x = "this text escape \ \ , unescape keep writing"
which prints as
"this text escape , unescape keep writing"
if want print 2 lines
x = "this text escape \n\ \ , unescape keep writing"
which prints as
this text escape , unescape keep writing
Comments
Post a Comment