118
\$\begingroup\$

Background

This is a standard textbook example to demonstrate for loops.

This is one of the first programs I learnt when I started learning programming ~10 years ago.

Task

You are to print this exact text:

**********
**********
**********
**********
**********
**********
**********
**********
**********
**********

Specs

  • You may have extra trailing newlines.
  • You may have extra trailing spaces (U+0020) at the end of each line, including the extra trailing newlines.

Scoring

This is . Shortest answer in bytes wins.

\$\endgroup\$
10
  • 3
    \$\begingroup\$ @DylanMeeus "You are to print this exact text:" \$\endgroup\$
    – Leaky Nun
    Aug 4, 2016 at 12:56
  • 14
    \$\begingroup\$ @DylanMeeus Since that is to do with the dev tools hiding repeated console outputs, and isn't native to JavaScript consoles as a whole and is not in the JavaScript spec - as well as the fact that feature can be turned off - i think it should be acceptable. Not all browsers will collapse it like that. \$\endgroup\$
    – James T
    Aug 4, 2016 at 12:58
  • 8
    \$\begingroup\$ @LeakyNun Leaderboard snippet please! \$\endgroup\$
    – anna328p
    Aug 4, 2016 at 22:08
  • 4
    \$\begingroup\$ One of the most interesting things about this challange is that depending on your language ********** can be shorter then a loop. Makes me wonder when it's better for a given language to switch between 1 or 2 loops. \$\endgroup\$
    – dwana
    Aug 5, 2016 at 9:14
  • 3
    \$\begingroup\$ you say trailing new lines are acceptable. Are leading newlines acceptable too? \$\endgroup\$ Feb 10, 2017 at 2:34

393 Answers 393

1
10 11 12 13
14
0
\$\begingroup\$

Java, 46 bytes

$->System.out.print("**********\n".repeat(10))

Try it online!

\$\endgroup\$
0
\$\begingroup\$

Python 3 (23 bytes)

print(('*'*10+'\n')*10)
\$\endgroup\$
1
  • \$\begingroup\$ 23 bytes - I believe '\n' is two bytes of code, but if you measured with len it will have said 22. \$\endgroup\$ Aug 7, 2016 at 6:16
-3
\$\begingroup\$

HTML, 136 bytes

**********<br>**********<br>**********<br>**********<br>**********<br>**********<br>**********<br>**********<br>**********<br>**********
\$\endgroup\$
6
  • 2
    \$\begingroup\$ You can use <pre> \$\endgroup\$
    – Leaky Nun
    Aug 5, 2016 at 16:45
  • 11
    \$\begingroup\$ This answer is valid and allowed, but it's also extremely boring and unimaginative. \$\endgroup\$
    – DJMcMayhem
    Aug 5, 2016 at 17:08
  • 1
    \$\begingroup\$ Ok, Can I post it in Markdown? \$\endgroup\$
    – Skxrda
    Aug 5, 2016 at 17:08
  • 3
    \$\begingroup\$ You can easily get this to 114 bytes with <pre> followed by the 109-byte text... \$\endgroup\$
    – Timtech
    Aug 27, 2016 at 21:43
  • 2
    \$\begingroup\$ I was hoping to join in on this one but unfortunately do not have the reputation for here yet. I'm not sure if this is an applicable method, but using html/emmet you can get this down to 20 bytes. ({**********}+br)*10 Alternatively p{**********}*10 is 16 bytes. New user to this site, so I'm unsure if the tab character counts. \$\endgroup\$
    – N.J.Dawson
    Sep 1, 2016 at 16:12
1
10 11 12 13
14

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.