I am trying to return a map type from a function.
ConsumeFood(Agent : agent)<suspends> : map =
But this error appears:
I am trying to return a map type from a function.
ConsumeFood(Agent : agent)<suspends> : map =
But this error appears:
Hey, map
is not directly a type, you have to specify the index type
and the value type
of the map
(maps are also called associative arrays, you can search it up on google)
So for example, you could declare
ConsumeFood(Agent: agent)<suspends>:[agent]int=
NewMap : [agent]int = map{Agent => 0}
return NewMap
Doesn’t make much sense here, but it compiles, I think you should learn more about maps and try to restructure your code, imo the ConsumeFood
function should edit a global food map variable and return void