# Left hand side of the argument

**URL:** <https://discourse.processing.org/t/left-hand-side-of-the-argument/13771>\
**Category:** Coding Questions\
**Created:** [September 3, 2019, 2:47am UTC](https://discourse.processing.org/t/left-hand-side-of-the-argument/13771 "2019-09-03T02:47:23Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![paulgoux](https://avatars.discourse-cdn.com/v4/letter/p/b9bd4f/32.png) [@paulgoux](https://discourse.processing.org/u/paulgoux)\
**Post date:** [September 3, 2019, 2:47am UTC](https://discourse.processing.org/t/left-hand-side-of-the-argument/13771/1 "2019-09-03T02:47:23Z")

</div>

Converting code from P5.js. In the original code I had an array which can be flexible in p5 which I used to store the location of the Objects I’m working with, and In my function I would call the location in the array and change the Object to another Object when a condition was met. This worked fine.

In Processing I’m now attempting to use ArrayLists to do the same this and I would have thought the same logic applied, However I receive a “left hand side of the argument must be a variable”.

To clarify this is an assignment I’m making in a for loop.

```auto
void djikstra(){
  if(pathfind.toggle==1&&target!=null&&pathfinder.get(0)!=null){
     target.visited = true;
     target.pcol2 = color(255,0,0);
     target.fillc();

     for( int i=pathfinder.size()-1;i>-1;i--){
       pathbackup.get(0).pcol2 = color(0);
       pathfinder.get(i).pcol2 = color(0,0,0,150);
       stroke(0);
       //strokeWeight(1);
       //line(pathfinder.get(i).x,pathfinder.get(i).y,target.x,target.y);
       strokeWeight(0);
     if(pathfinder.get(i)!=null&&(pathfinder.get(i).y!=target.y||pathfinder.get(i).x!=target.x)&&!completed){
     searching = true;
     TP next = pathfinder.get(i).find(target,false);
     pathfinder.get(i).visited2 = true;

     if(next!=null){
     next.pcol2 = color(0,0,0,150);
     next.depth = pathfinder.get(i).depth;
     pathfinder.get(i).highlight();
     pathfinder.get(i).visited3 = false;
     stack2.get(i).add(pathfinder.get(i));
     pathhist.get(i).add(pathfinder.get(i));
     
 //---------*Offending Code Here*--------------------------------------------------------------
     pathfinder.get(i) = next;
     }
     else if(stack2.get(i).size()>0){

     TP next1 = pathfinder.get(i).find(target,false);
     if(next1){

       if(!pathfinder.get(i).visited3){
         pathfinder.get(i).pcol2 = color(0,0,0,150);
       }
       else{
         pathfinder.get(i).pcol2 = pathfinder.get(i).pcol;
       }}
     else {
       pathfinder.get(i).visited3 = true;
       pathfinder.get(i).pcol2 = color(0,0,0,0);
     }

     trimpathStack(stack2.get(i));
     pathfinder.get(i) = stack2.get(i).pop();

      }
    }
     else{
         fill(255);
         text("success",10,10);
         searching = false;
         pathfinder.get(i).completed = true;
         completed = true;
     }
     if(pathfinder.get(i).completed){

     }
     if(completed&&!pathfinder.get(i).completed){

     }
 }}

};

```

---

<div class="post-metadata">

**Author:** ![GoToLoop](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/gotoloop/32/86_2.png) [@GoToLoop](https://discourse.processing.org/u/GoToLoop)\
**Post date:** [September 3, 2019, 2:58am UTC](https://discourse.processing.org/t/left-hand-side-of-the-argument/13771/2 "2019-09-03T02:58:03Z")

</div>

[Docs.Oracle.com/en/java/javase/11/docs/api/java.base/java/util/List.html#set(int,E)](http://Docs.Oracle.com/en/java/javase/11/docs/api/java.base/java/util/List.html#set(int,E))
