I really love the Julia’s syntax for """ with indents (See doc):
julia> function check_string_indent()
s = """
foo
bar
"""
return s
end
check_string_indent (generic function with 1 method)
julia> check_string_indent()
"foo\nbar\n"
But, is there any way to define a string " foo\n bar\n " in one """ ... """ block directly?
The following s1 and s2 doesn’t work, and s3 seems a little dirty for me.
julia> function check_string_indent()
s1 = """
foo
bar
"""
s2 = """ foo
bar
"""
s3 = """
foo
bar
""" * " "
@show s1
@show s2
@show s3
return
end
check_string_indent (generic function with 1 method)
julia> check_string_indent()
s1 = "foo\nbar\n"
s2 = " foo\nbar\n"
s3 = " foo\n bar\n "
I’m not having trouble with this, but I’m just simply curious.