Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8857995
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T14:43:30+00:00 2026-06-14T14:43:30+00:00

So I need to repeat text 40 times, I figured out how to do

  • 0

So I need to repeat text 40 times, I figured out how to do a line a certain amount of times, but using the same process for text is not working, ive tried messing around with different code but I am stuck.

Any help would be great.

I just need to repeat the word “text” 40 times in the program.

Here is my current code:

void setup() {
    size(640, 360);
    textFont(createFont("Georgia", 24));
}

void draw() {
    background(102);
    textAlign(RIGHT);
    drawType(width * 0.10);
}

void drawType(float x) {

    fill(0);

    float y = 35;
    int spacing = 50;
    int endLine = 640;

    while (x <= endLine){
        text("text", x, y, 50, 50);
        x = x + y + spacing;
    }
}

I’m using the language Processing, (processing.org), which is a type of JAVA.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-14T14:43:31+00:00Added an answer on June 14, 2026 at 2:43 pm

    Just thought i would be clear with my comment:

    try

    String var="";
     for(int i=0;i<40;i++)
        {
           var=var+"text";
         }
    
    //Then use the variable got 
    
     text(var, x, y, 50, 50);
    

    There may be built in functions to do this in a better way, but this would be a simple way to solve your problem.

    This method though is in-efficient as String operations are costly in Java because they are immutable.

    The above example would print the same string 40 times in a single line(depending upon the length of the line).

    If the horizontal length of the line is not sufficient, either increase the line size or decrease the spacing or decrease the number of times you are repeating the string.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a simple function I need to repeat 3 times for 3 seperate
Hej sharp minds! I need to load text file into hash. One line is
I have a ListBox and I need to repeat the styles to be the
Imagine a matrix : a = 4 2 8 9 I need to repeat
I need the function to repeat after 8 seconds the first time and then
I need to count number of repeating and position where they repeat of all
I need to do the following animation with an audio clip, on repeat: Show
My SOLR is used to store events. Events can repeat. I need to filter
Need some regular expressions help. So far I have my code working to allow
I have text in the follwing format: ERR_OUT_OF_MEM, ERR OUT OF MEM ERR_SOMETHING_BAD, ERR

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.