printf not working when using variable in single qoutes in a line closing in triple qoutes


#1

The following code is not working:
name = “Shivansh"
println(”"“Hello, my name is “$name””"")


#2

That’s because the triple double quotes after the letter e are parsed as the ending of the string, leaving the last double quote as a new opening one. You can just escape the ones surrounding $name as such:

julia> name = "Shivansh"
       println("""Hello, my name is \"$name\"""")
Hello, my name is "Shivansh"


#3

Thanks for explanation.