Warning: file_get_contents(/data/phpspider/zhask/data//catemap/5/google-sheets/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Netlogo数组需要文字值_Netlogo - Fatal编程技术网

Netlogo数组需要文字值

Netlogo数组需要文字值,netlogo,Netlogo,数组需要一个文本值 set chrom [forage_min forage_rate share_min share_rate mating_treshold] print chrom 我怎么办?我真的不理解Netlogo中的数组。(您在问题中提到“数组”,但我认为您的意思是“列表”。可以通过使用Netlogo中的数组,但除非您有非常特殊的需要,否则这可能不是您想要的。因此,假设您正在尝试创建列表:) 用于声明列表的方括号语法仅适用于“文字”值,例如原始字符串或数字。如果要用

数组需要一个文本值

set chrom [forage_min forage_rate share_min share_rate mating_treshold]
        print chrom
我怎么办?我真的不理解Netlogo中的数组。

(您在问题中提到“数组”,但我认为您的意思是“列表”。可以通过使用Netlogo中的数组,但除非您有非常特殊的需要,否则这可能不是您想要的。因此,假设您正在尝试创建列表:)

用于声明列表的方括号语法仅适用于“文字”值,例如原始字符串或数字。如果要用变量或更复杂的表达式构建列表,则需要使用原语。在您的情况下,这将类似于:

set chrom (list forage_min forage_rate share_min share_rate mating_treshold)
我鼓励你读这本书