tasidonya
tasidonya

Reputation: 79

Is there a multi-line string syntax in Netlogo?

In Python there is a way to store long, multi-line text into a variable like so:

    a_string = """
          This is a very long string
          that spans multiple lines
          and I do not need to worry about
          line breaks
    """

My question: Is there a similar thing in NetLogo where I can just encase a block of text into special characters and store into a variable? Any alternative ways, such as string concatenation will work too, like so:

a_string = "This is a very long string"
           + "and I might need to use some regexes"
           + "to get it into this format\n"
           + "as long as it's possible to do so."
           

So far I could not find anything like the former example, have not really searched for the latter as the former is my preference, but would appreciate any other alternatives.

Upvotes: 1

Views: 208

Answers (1)

Jasper
Jasper

Reputation: 2780

The word primitive should be able to do what you want. Just make sure to surround it with parentheses to handle multiple values. Example:

to set-a-string
  let a_string (word "This is a very long string"
           "and I might need to use some regexes"
           "to get it into this format\n"
           "as long as it's possible to do so.")
end

Upvotes: 2

Related Questions