Trying to have an output repeat

  • Thread starter Thread starter magnifik
  • Start date Start date
  • Tags Tags
    Output
Join the discussion
Registration is free. Ask a follow-up in this thread, or start your own.
1 reply · 2K views
magnifik
Messages
350
Reaction score
0
How do you make a string repeat itself for a given number of times?
For example, if I wanted to make "3y" print out "yyy" on the screen (it prints "y" 3 times because the number in the input is 3).. how would i do this using functions?
 
Physics news on Phys.org
you could just parse the input string; but of course, you will need to include some specifications, or the input/output you want can be very vague ('33y') can be 33 times of y or 3 times of 3y.