# Help for a code

**URL:** <https://discourse.processing.org/t/help-for-a-code/4561>\
**Category:** Coding Questions\
**Created:** [October 17, 2018, 3:04pm UTC](https://discourse.processing.org/t/help-for-a-code/4561 "2018-10-17T15:04:04Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![singenya](https://avatars.discourse-cdn.com/v4/letter/s/839c29/32.png) [@singenya](https://discourse.processing.org/u/singenya)\
**Post date:** [October 17, 2018, 3:04pm UTC](https://discourse.processing.org/t/help-for-a-code/4561/1 "2018-10-17T15:04:05Z")

</div>

hello I need help on a code, I’m trying to make a line that would move from the top to bottom and  
when it reach the bottom it get back to the top. I’ve done this and achieved making it get down but  
I can’t manage to make it getting back up.  
 ![image](https://canada1.discourse-cdn.com/flex036/uploads/processingfoundation1/original/2X/e/e9605ee31893f0780989748520c43b580e69aa17.png)  
thanks for your help

---

<div class="post-metadata">

**Author:** ![TfGuy44](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/tfguy44/32/41_2.png) [@TfGuy44](https://discourse.processing.org/u/TfGuy44)\
**Post date:** [October 17, 2018, 5:23pm UTC](https://discourse.processing.org/t/help-for-a-code/4561/2 "2018-10-17T17:23:10Z")

</div>

Retyping out the code you already (so I could run it to see what your sketch does) has used up all the time and effort I had to spare.

Perhaps some other nice person will come along and help you more.

```auto
int d = 110;
int b = 25;

void setup() {
  size(600, 600);
}

void draw() {
  background(255);
  if ( 0 <= b && b <= 515 ) {
    b++;
  }
  if ( 85 <= d && d <= 600 ) {
    d++;
  }
  line( 25, b, 25, d);
}

```

That said, nowhere in your code are you even attempting at making the line go back up. How will your sketch remember which way the line should be moving? When will it know to change direction? Do your variables’ values need to change by a different amount depending on which way the line should be going?

Please at least try to make it work, and post the code of your attempt (AS TEXT!).
