# How to make shapes out of characters using loop?

I am trying to make a circle that is made out of English Alphabet. I made a String that included the entire alphabet and I tried creating the circle using each character from the string individually using ‘for’ command (loop) but it didn’t work out for me.

I made a small example of what I am trying to create but this time I created the code without using a loop, I only created a small part of the circle since I didn’t want the code to get too repetitive and long for you to read. Can someone help me solve this?

``````int cx;
int cy;
float x;
float y;
int character;
float angle;
String message;

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

void draw(){
background(0);
cx = width/2;
cy = height/2;
message = "ABCDEFGHIJKLMNOPQRSTUVWXYZ"; //26 chars

textSize(30);
character = 0;
text(message.charAt(character),x,y);

character = 1;
text(message.charAt(character),x,y);

character = 2;
text(message.charAt(character),x,y);

character = 3;
text(message.charAt(character),x,y);

character = 5;
text(message.charAt(character),x,y);

character = 6;
text(message.charAt(character),x,y);

character = 7;
text(message.charAt(character),x,y);

character = 8;
text(message.charAt(character),x,y);
}
``````
1 Like

Are you asking how to us a `for` loop to cut down on the repetition in your code?

Using a `for` loop is all about noticing a pattern. For example, you could start by making a table:

character angle
0 angle + 0
1 angle + 14
2 angle + 28

Hopefully you notice a pattern, and if not, I recommend filling out more of the table.

Anyway, once you notice a pattern, you can create a `for` loop that iterates over that pattern and some arithmetic that uses it. Here’s an example:

``````  for (int character = 0; character < 10; character++) {
Shameless self-promotion: here is a tutorial on using `for` loops in Processing: