0 votes

[copied from GT FB group]

I am trying to have a 3 stanza poem be the password to unlocking the final portion of the program… How would I create a line break in the code so the program can understand it?

by (5.8k points)

1 Answer

0 votes

 If you simply wish to display line breaks, the simplest way to do that is to define a blank variable, like this:

>>blank = " "

And insert {blank} wherever you want a line break.

If your program is embedded, you can also group your text using the *group keyword and add a class that creates a line break after each paragraph.

If you wish for the answer to be dependent on the poem being entered exactly correctly, including line breaks, that is more complicated.

by (5.8k points)
edited by
Hello, I am having a similar problem. I have several paragraphs of text that are repeated multiple times in my program. I want to save the text as a variable, with line breaks separating each paragraph, and then insert this variable in the code wherever it's needed.

Based on the suggestion above, I have tried this:

>>blank = ""
>>repeated_text = ["paragraph 1.{blank}paragraph 2.{blank}.paragraph 3"]
{repeated text}

And also:

>>blank = ""
>>repeated_text = ["paragraph 1.", "paragraph 2", "paragraph 3"]
{repeated_text[1]}{blank}{repeated_text[2]}{blank}{repeated_text[3]}

As well as trying out several other approaches. None of these result in a line break being displayed in the output (it seems instead they simply add no text (i.e. "") wherever the {blank} is inserted, resulting in no change to the text.

Any advice would be much appreciated. Thank you!
Hey there!

I just had an idea about using *html keyword and <p> and <br> HTML tags to achieve this. Check out https://www.guidedtrack.com/programs/15083/edit

Would this work for your use case?

*html
    <p>{p1}</p>
    <br>
    <p>{p2}</p>
    <br>
    <p>{p3}</p>
Welcome to Guidedtrack Q&A, where you can ask questions and receive answers from other members of the community.
134 questions
144 answers
55 comments
40 users