How to create a string with a repeated character N times in Scala

1 Answer

0 votes
object Main extends App {
  val repeated = "*" * 10 // Repeats '*' 10 times
  
  println(repeated)
}



/*
run:
 
**********
 
*/

 



answered Jul 28, 2025 by avibootz
...