Created
August 30, 2021 04:07
-
-
Save langsharpe/71734384eb6914708563159358d0349d to your computer and use it in GitHub Desktop.
Ruby Heredoc Syntax for String Literals
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# The one you want is | |
def method | |
string = <<~END | |
This format allows you to indent the contents of the string without including the indent in the value. | |
String interpolation works here. | |
END | |
string2 = <<~'END' | |
The single quotes around END prevent string interpolation here. It's also good for \_ ascii art _/ . | |
END | |
end | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment