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.
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
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.