# How to increase number?

**URL:** https://discourse.processing.org/t/how-to-increase-number/23024
**Category:** Beginners
**Created:** [August 3, 2020, 11:03pm UTC](https://discourse.processing.org/t/how-to-increase-number/23024 "2020-08-03T23:03:58Z")
**Posts on this page:** 15
**Page:** 1

<div class="post-metadata">

### Author: ![Rai](https://avatars.discourse-cdn.com/v4/letter/r/67e7ee/32.png) [@Rai](https://discourse.processing.org/u/Rai)
#### Post date: [August 3, 2020, 11:03pm UTC](https://discourse.processing.org/t/how-to-increase-number/23024/1 "2020-08-03T23:03:58Z")

</div>

```auto
int i = 33;
void setup() {
}
void draw() {
  for (char c = char(i); c < i+58; c++)
  println( i + " : " + c);
}

```

how to increase number i to 34, 35, 36, etc  
thanks

---

<div class="post-metadata">

### Author: ![glv](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/glv/32/18785_2.png) [@glv](https://discourse.processing.org/u/glv)
#### Post date: [August 4, 2020, 3:08am UTC](https://discourse.processing.org/t/how-to-increase-number/23024/2 "2020-08-04T03:08:44Z")

</div>

> [@Rai](#):
>
> `c = char(i);`

Consider using i in the for loop to increment and then  
`c = char(i);`  
in the loop.

> **[for / Reference](https://processing.org/reference/for.html)**
>
> Controls a sequence of repetitions. A basic for structure has three parts: init, test, and update. Each part must be separated by a semicolon (;). The loop continues until …

I leave the rest with you.

`:)`

---

<div class="post-metadata">

### Author: ![ForgottenCat](https://avatars.discourse-cdn.com/v4/letter/f/e9a140/32.png) [@ForgottenCat](https://discourse.processing.org/u/ForgottenCat)
#### Post date: [August 4, 2020, 9:51am UTC](https://discourse.processing.org/t/how-to-increase-number/23024/3 "2020-08-04T09:51:00Z")

</div>

> [@Rai](#):
>
> ```auto
> int i = 33;
> void setup() {
> }
> void draw() {
> for (char c = char(i); c < i+58; c++)
> println( i + " : " + c);
> }
> 
> ```

```auto
int i = 33;
void setup() {
    for (int j = i; j < i+58; j++){
    println( j + " : " + char(j));
  }
}
void draw() {

}

```

increasing i (by using i++;) inside the for loop leads to an infinite loop. (calling it in draw as well, move it to setup() to execute it once)

---

<div class="post-metadata">

### Author: ![Chrisir](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/chrisir/32/45_2.png) [@Chrisir](https://discourse.processing.org/u/Chrisir)
#### Post date: [August 4, 2020, 10:50am UTC](https://discourse.processing.org/t/how-to-increase-number/23024/4 "2020-08-04T10:50:03Z")

</div>

you can also increase c if you like

c++ is just short for c = c + 1

```auto
int i = 33;

void setup() {
  for (char c = char(i); c < char(i+58); c++) {
    println( int(c) + " : " + c);
  }
}

void draw() {
  //
}

```

**Other way**

or use i as a secondary variable along with c

```auto

final int startAscii = 33;

void setup() {
  size(333, 333); 

  int i=startAscii;
  for (char c = char(startAscii); c < char(startAscii+58); c++) {
    println( i + " : " + c);
    i++;
  }//for
}//func 

void draw() {
  //
}//func

```

---

<div class="post-metadata">

### Author: ![elon](https://avatars.discourse-cdn.com/v4/letter/e/51bf81/32.png) [@elon](https://discourse.processing.org/u/elon)
#### Post date: [August 4, 2020, 8:21pm UTC](https://discourse.processing.org/t/how-to-increase-number/23024/5 "2020-08-04T20:21:14Z")

</div>

> [@Rai](#):
>
> ```auto
> int i = 33;
> void setup() {
> }
> void draw() {
> 
> for (char c = char(i); c < i+58; c++)
> println( i + " : " + c);
> }
> 
> ```

```auto
int i = 33;
void setup() {
}
void draw() {
if(i<37){i+=1}
  for (char c = char(i); c < i+58; c++)
  println( i + " : " + c);
}

```

---

<div class="post-metadata">

### Author: ![glv](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/glv/32/18785_2.png) [@glv](https://discourse.processing.org/u/glv)
#### Post date: [August 4, 2020, 11:19pm UTC](https://discourse.processing.org/t/how-to-increase-number/23024/6 "2020-08-04T23:19:28Z")

</div>

> [@Rai](#):
>
> how to increase number i to 34, 35, 36, etc

> **[++ (increment) / Reference](https://processing.org/reference/increment.html)**
>
> Increases the value of an integer variable by 1. Equivalent to the operation i = i + 1. If the value of the variable i is five, then the expression i++ increases the value of i…

> **[+ (addition) / Reference](https://processing.org/reference/addition.html)**
>
> Adds two values or concatenates string values. As a mathematical operator, it calculates the sum of two values. As a string operator, it combines two strings into one and converts from primitive datat…

You could also subtract a negative number:

> **[\- (minus) / Reference](https://processing.org/reference/minus.html)**
>
> Subtracts one value from another and may also be used to negate a value. As a subtraction operator, the value of the second parameter is subtracted from the first. For example, 5 - 3 yields the number…

`:)`

---

<div class="post-metadata">

### Author: ![Rai](https://avatars.discourse-cdn.com/v4/letter/r/67e7ee/32.png) [@Rai](https://discourse.processing.org/u/Rai)
#### Post date: [August 5, 2020, 1:22am UTC](https://discourse.processing.org/t/how-to-increase-number/23024/7 "2020-08-05T01:22:06Z")

</div>

thank you very much all

---

<div class="post-metadata">

### Author: ![kfrajer](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/kfrajer/32/196_2.png) [@kfrajer](https://discourse.processing.org/u/kfrajer)
#### Post date: [August 5, 2020, 6:49pm UTC](https://discourse.processing.org/t/how-to-increase-number/23024/8 "2020-08-05T18:49:49Z")

</div>

This is one way to get the alphabet in lowercase and the code is easier to read. Even better, `letter <= 'z'`.

Kf

```auto
final int N_LETTERS=26;
for (char letter= 'a'; letter < 'a'+N_LETTERS; letter++) {
    println( int(letter) + " : " + letter);
}

```

---

<div class="post-metadata">

### Author: ![glv](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/glv/32/18785_2.png) [@glv](https://discourse.processing.org/u/glv)
#### Post date: [August 6, 2020, 5:38pm UTC](https://discourse.processing.org/t/how-to-increase-number/23024/9 "2020-08-06T17:38:38Z")

</div>

Hello,

What was _your_ final solution?

`:)`

---

<div class="post-metadata">

### Author: ![noel](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/noel/32/213_2.png) [@noel](https://discourse.processing.org/u/noel)
#### Post date: [August 6, 2020, 6:37pm UTC](https://discourse.processing.org/t/how-to-increase-number/23024/10 "2020-08-06T18:37:00Z")

</div>

Maybe the username? 😁

---

<div class="post-metadata">

### Author: ![glv](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/glv/32/18785_2.png) [@glv](https://discourse.processing.org/u/glv)
#### Post date: [August 6, 2020, 6:46pm UTC](https://discourse.processing.org/t/how-to-increase-number/23024/11 "2020-08-06T18:46:54Z")

</div>

> [@noel](#):
>
> Maybe the username? 😁

I hope it will be @Rai

I am interested in what _his solution_ (without referencing or cutting and pasting code) was after gleaning through this topic.

`:)`

---

<div class="post-metadata">

### Author: ![Rai](https://avatars.discourse-cdn.com/v4/letter/r/67e7ee/32.png) [@Rai](https://discourse.processing.org/u/Rai)
#### Post date: [August 7, 2020, 3:24am UTC](https://discourse.processing.org/t/how-to-increase-number/23024/12 "2020-08-07T03:24:15Z")

</div>

i’m ask because i don’t know what wrong with this code not because homework or something so @ForgottenCat explain to me my code wrong because put in void draw () make i in infinite loop, i ask and learn processing for my self not school or something so if i’m just copy paste from this answer i can’t get anything, i’m here to ask for learn not for copy paste @glv

---

<div class="post-metadata">

### Author: ![Rai](https://avatars.discourse-cdn.com/v4/letter/r/67e7ee/32.png) [@Rai](https://discourse.processing.org/u/Rai)
#### Post date: [August 7, 2020, 4:04am UTC](https://discourse.processing.org/t/how-to-increase-number/23024/13 "2020-08-07T04:04:08Z")

</div>

please don’t think all beginners just school student ask for homework

---

<div class="post-metadata">

### Author: ![ForgottenCat](https://avatars.discourse-cdn.com/v4/letter/f/e9a140/32.png) [@ForgottenCat](https://discourse.processing.org/u/ForgottenCat)
#### Post date: [August 7, 2020, 5:21am UTC](https://discourse.processing.org/t/how-to-increase-number/23024/14 "2020-08-07T05:21:15Z")

</div>

Hi Rai,

processing calls (=executes) the setup only once at startup. so it is great to initize any variables etc.  
draw is sort of a loop. so it executes and if its finished, it restarts at the first line after draw(){. to avoid that, you have many possibilities, like “move it to setup” or check for a condition therefore moving it in some if statement.

---

<div class="post-metadata">

### Author: ![glv](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/glv/32/18785_2.png) [@glv](https://discourse.processing.org/u/glv)
#### Post date: [August 7, 2020, 6:22am UTC](https://discourse.processing.org/t/how-to-increase-number/23024/15 "2020-08-07T06:22:42Z")

</div>

Hello Rai,

In your original you post you shared code and asked:

> [@Rai](#):
>
> how to increase number i to 34, 35, 36, etc

You also messaged me directly and I asked you to:

> [@On another topic](https://discourse.processing.org/t/23005/2):
>
> Please post in the public forum.

I was the first to respond…

I tried to understand what you were doing, wrote some code, and gave you some direction and references. I did not share a complete solution with you; this was very achievable by you.

> [@Rai](#):
>
> please don’t think all beginners just school student ask for homework

Your last two posts mentioned homework and school; I did not raise this point in this topic.

The community here all stepped in to help you with a lot of examples.

I was genuinely interested in what you learned from this and _your final solution_ and I am still interested in what that is.

`:)`
