Skip to content

Triple Quoted Strings

rollynoel edited this page Jun 18, 2013 · 4 revisions

Added by betson betson

Triple quoted strings in Boo are used to preserve spacing and linebreaks without a thick slathering of \n's all over your precious code.

It is good for visually representing XML, for instance:

xml = """
<xml>
     <randomElement>
     </randomElement>
</xml>
"""

It is also most excellent for formatting console output:

name = prompt("Name: ")
age = prompt("Age: ")
sex = prompt("Sex: ")

print """

Hello, ${name}!

My name is Hal, and I will be your Operating System today.

My sensors indicate that you are a ${age} year old ${sex}

If you need any assistance navigating this user interface, please ask.

...

Humans are so fragile...

"""
Clone this wiki locally