Netlogo 中是否有多行字符串语法?
Is there a multi-line string syntax in Netlogo?
在 Python 中有一种方法可以将长的多行文本存储到变量中,如下所示:
a_string = """
This is a very long string
that spans multiple lines
and I do not need to worry about
line breaks
"""
我的问题:在 NetLogo 中是否有类似的东西,我可以将一段文本封装成特殊字符并存储到一个变量中?任何替代方法,例如字符串连接也可以,如下所示:
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."
到目前为止,我找不到与前一个示例类似的东西,也没有真正搜索过后者,因为我更喜欢前者,但希望能有其他选择。
word
primitive 应该可以做你想做的事。只需确保用括号将其括起来即可处理多个值。示例:
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
在 Python 中有一种方法可以将长的多行文本存储到变量中,如下所示:
a_string = """
This is a very long string
that spans multiple lines
and I do not need to worry about
line breaks
"""
我的问题:在 NetLogo 中是否有类似的东西,我可以将一段文本封装成特殊字符并存储到一个变量中?任何替代方法,例如字符串连接也可以,如下所示:
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."
到目前为止,我找不到与前一个示例类似的东西,也没有真正搜索过后者,因为我更喜欢前者,但希望能有其他选择。
word
primitive 应该可以做你想做的事。只需确保用括号将其括起来即可处理多个值。示例:
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