I have a question about the number of turtles created from this code :
to read-turtles-from-csv
file-close-all ; close all open files
if not file-exists? "turtles.csv" [
user-message "No file 'turtles.csv' exists! Try pressing WRITE-TURTLES-TO-CSV."
stop
]
file-open "turtles.csv" ; open the file with the turtle data
; We'll read all the data in a single loop
while [ not file-at-end? ] [
let data csv:from-row file-read-line
create-turtles 1 [
print "item column 4"
show item 4 data
]
]
file-close ; make sure to close the file
end
My turtles.csv file has only two rows, so I What is expected here is that create-turtles 1 is repeated for the number of rows and I have two agents for which 2 numbers in the 4th column get printed. Surprisingly though, 4 turtles are created! Why?
Thanks