What I think you want (not tested) is this:
ask agents
[ let prey one-of agents-here
ask prey
[ set varname [varname] of myself
]
]
It appears your question is not really about let
, which is simply saying 'make the variable value the result of some statement'. Since the not-coded bit was about how to obtain the value of 'variable a of agent' then I think your question was about myself
.
The bit [] of
says 'get the value of a variable belonging to some agent' and myself
sort of jumps out a level of brackets to find the agent to which the variable belongs.
As a side note, it's probably not a good idea to have 'agents' as your turtles
breed
because it will be difficult to talk about your model - the word 'agent' will refer to one of your types of agent as well as being the general class of agents.