# Background

This is a standard textbook example to demonstrate for loops.

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

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.

Here is a Stack Snippet to generate both a regular leaderboard and an overview of winners by language.

/* Configuration */

var QUESTION_ID = 88653; // Obtain this from the url
// It will be like https://XYZ.stackexchange.com/questions/QUESTION_ID/... on any question page
var COMMENT_FILTER = "!)Q2B_A2kjfAiU78X(md6BoYk";
var OVERRIDE_USER = 48934; // This should be the user ID of the challenge author.

/* App */

return "https://api.stackexchange.com/2.2/questions/" +  QUESTION_ID + "/answers?page=" + index + "&pagesize=100&order=desc&sort=creation&site=codegolf&filter=" + ANSWER_FILTER;
}

}

jQuery.ajax({
method: "get",
dataType: "jsonp",
crossDomain: true,
success: function (data) {
data.items.forEach(function(a) {
});
comment_page = 1;
}
});
}

jQuery.ajax({
method: "get",
dataType: "jsonp",
crossDomain: true,
success: function (data) {
data.items.forEach(function(c) {
if (c.owner.user_id === OVERRIDE_USER)
});
else process();
}
});
}

var SCORE_REG = /<h\d>\s*([^\n,]*[^\s,]),.*?(\d+)(?=[^\n\d<>]*(?:<(?:s>[^\n<>]*<\/s>|[^\n<>]+>)[^\n\d<>]*)*<\/h\d>)/;

function getAuthorName(a) {
return a.owner.display_name;
}

function process() {
var valid = [];

var body = a.body;
if(OVERRIDE_REG.test(c.body))
body = '<h1>' + c.body.replace(OVERRIDE_REG, '') + '</h1>';
});

var match = body.match(SCORE_REG);
if (match)
valid.push({
user: getAuthorName(a),
size: +match[2],
language: match[1],
});

});

valid.sort(function (a, b) {
var aB = a.size,
bB = b.size;
return aB - bB
});

var languages = {};
var place = 1;
var lastSize = null;
var lastPlace = 1;
valid.forEach(function (a) {
if (a.size != lastSize)
lastPlace = place;
lastSize = a.size;
++place;

.replace("{{NAME}}", a.user)
.replace("{{LANGUAGE}}", a.language)
.replace("{{SIZE}}", a.size)

var lang = a.language;
if (/<a/.test(lang)) lang = jQuery(lang).text();

languages[lang] = languages[lang] || {lang: a.language, user: a.user, size: a.size, link: a.link};
});

var langs = [];
for (var lang in languages)
if (languages.hasOwnProperty(lang))
langs.push(languages[lang]);

langs.sort(function (a, b) {
if (a.lang > b.lang) return 1;
if (a.lang < b.lang) return -1;
return 0;
});

for (var i = 0; i < langs.length; ++i)
{
var language = jQuery("#language-template").html();
var lang = langs[i];
language = language.replace("{{LANGUAGE}}", lang.lang)
.replace("{{NAME}}", lang.user)
.replace("{{SIZE}}", lang.size)
language = jQuery(language);
jQuery("#languages").append(language);
}

}
body { text-align: left !important}

width: 290px;
float: left;
}

#language-list {
width: 290px;
float: left;
}

font-weight: bold;
}

table td {
}
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<tr><td></td><td>Author</td><td>Language</td><td>Size</td></tr>

</tbody>
</table>
</div>
<div id="language-list">
<h2>Winners by Language</h2>
<table class="language-list">
<tr><td>Language</td><td>User</td><td>Score</td></tr>
<tbody id="languages">

</tbody>
</table>
</div>
<table style="display: none">
</tbody>
</table>
<table style="display: none">
<tbody id="language-template">
</tbody>
</table>

• @DylanMeeus "You are to print this exact text:" – Leaky Nun Aug 4 '16 at 12:56
• @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. – Trotski94 Aug 4 '16 at 12:58
• @LeakyNun Leaderboard snippet please! – anna328p Aug 4 '16 at 22:08
• 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. – dwana Aug 5 '16 at 9:14
• you say trailing new lines are acceptable. Are leading newlines acceptable too? – Albert Renshaw Feb 10 '17 at 2:34

## Retina, 12 bytes

Byte count assumes ISO 8859-1 encoding. The leading linefeed is significant.


10$** .$_¶


The first stage writes a string of ten asterisks, the second stage replaces each asterisk with the entire string and a linefeed. This prints two trailing linefeeds.

# J, 10 9 bytes

• Also 9 bytes: '*'$~,~10 – Conor O'Brien Aug 4 '16 at 18:26 ## Mathematica, 24 bytes Print@"**********"~Do~10  It's kinda unfortunate that StringRepeat alone is 12 characters long... # Julia, 23 22 bytes print(("*"^10*" ")^10)  See here to test on an online interpreter. Thanks @Dennis for the tip! • Try changing your code to function output. – Mama Fun Roll Aug 12 '16 at 23:06 # Sesos, 11 bytes With many thanks to Leaky Nun for his help, and credit to his Brainf*ck answer, which inspired this one. Golfing suggestions welcome. Try It Online! 0000000: A8 24 BE EC CB 82 06 BD A7 EC 0E .$.........


How it works

The binary file above has been generated by assembling the following SASM code.

add 42,fwd 1,add 10,fwd 1,add 10  # puts 42, 10, 10 in the register
jmp,sub 1,rwd 1                   # starts the first loop
jmp,sub 1,rwd 1,put,fwd 1,jnz     # second loop prints 42 or "*"
add 10,put,fwd 1                  # resets first loop, prints 10 or "\n"
# first loop ends implicitly

• Congratulations! – Leaky Nun Aug 5 '16 at 13:45

# Unary, 3584048336806633376708256331142263836115215 bytes

Can't post it here for obvious reasons.

But it's literally just 3584048336806633376708256331142263836115215 zeroes.

# T-SQL, 35 bytes

I used a hard carriage return in the string, which is why it wraps to the next line.

select replicate('**********
',10)

• Save 1 byte by using PRINT instead of SELECT – BradC Jan 30 '18 at 21:30

## DOG, 22 bytes

10 bark "**********\n"


Prints out ********** and a newline 10 times.

Try it online! (you'll have to manually copy the code since I don't have permalink functionality yet ;_;)

• A cat posting in DOG language... interesting, could have sworn you were sworn enemies of the household – ʰᵈˑ Aug 9 '16 at 7:59
• @ʰᵈˑHe's learning the enemy language to become a spy. – user47018 Aug 9 '16 at 18:03
• @Midnightas ahaha yes! – ʰᵈˑ Aug 10 '16 at 8:24

# Perl 6,  19 17  16 bytes

say '*'x 10 for ^10
put '*'x 10 for ^10
put('*'x 10)xx 10
put(\*x 10)xx 10

Try it

## Explanation:

put(       # print with trailing newline
'*' x 10 # ｢*｣ string repeated 10 times
) xx 10    # list repeat the above 10 times


Apparently \* or \(*) which is short for Whatever.new.list.Capture when coerced to a Str turns into just *.

• I've recently discovered that \* (a Capture containing one Whatever) stringifies to the asterisk, at one less byte than '*'. – smls Mar 3 '17 at 7:18

# Common Lisp, SBCL, 393835323129 28 bytes

(format t"~10{~10@{*~}
~}"1)


Ideas for improvement are welcomed.

~10{...~} ;loops 10 times, doing inside loop and printing newline
~10@{*~}  ;loops 10 times, displaying ten "*"

• In this form it gives me an error, maybe '(1) instead of 1 ? – Renzo Sep 28 '17 at 18:44
• @Renzo Are you sure you tried it in SBCL? It works for me both when written to REPL and when loaded from file. It is true however that it does not work in TIO - they use Clisp implementation I think. – user65167 Sep 30 '17 at 15:19
• You are right, I tried it in CCL and in TIO, where it does not work. But, it works in SBCL. – Renzo Sep 30 '17 at 19:13

## TSQL, 24bytes

PRINT'**********'
GO 10


My first submission, please be kind with any help :)

# Python 2, 21 Bytes

exec"print'**'*5;"*10


Works in a similar way to Destructible Watermelon's Python 3 solution.

• Yay I inspired someone! – Destructible Lemon Aug 4 '16 at 9:46
• Unfortunately, it only ties with the other Python 2 solution. :( – Steven H. Aug 4 '16 at 9:48
• Well, at least it is relevant in Python 2 – Destructible Lemon Aug 4 '16 at 9:49
• Same length: exec"print'*'*10;"*10 – mbomb007 Sep 20 '16 at 19:43

# ///, 25 bytes

/a/**********
/aaaaaaaaaa


Try it online!

A simple replace command.

• It's screaming! – mınxomaτ Aug 5 '16 at 14:08

## CJam, 9 8 bytes

Thanks to Lynn for saving 1 byte.

'*A*N]A*


Try it online!

### Explanation

'*A*    e# Create a string of 10 asterisks.
N       e# Push a linefeed.
]       e# Wrap both in a list.
A*      e# Repeat 10 times.

• '*A*N]A* is 8 bytes. – Lynn Aug 4 '16 at 11:55

# ><>, 28 bytes

av
->:?!;av>~1ao
:-1o*76<^!?


Try it online!

# Befunge, 39 bytes

52*>52* v
,1-:!#v_>67*
#@_v  >\$52*,1-:!


Try it here!

• This is 39 bytes; you don't need to count the trailing newline – Justin Aug 4 '16 at 17:54
• Thanks, I guess my text editor put a trailing newline somewhere and added to the file size. – user55852 Aug 4 '16 at 18:02
• Shorter version by switching the movement direction to be left instead of right: (36 bytes) ideone.com/GZi1PG – Justin Aug 4 '16 at 18:03

## Actually, 7 bytes

9u;'**n


Try it online!

Explanation:

9u;'**n
9u;      push two copies of 10
'*    push "*"
*   multiply by one of the copies, yielding "**********"
n  push 10 total copies of the string


# PowerShell, 14 bytes

0..9|%{'*'*10}


Items exiting the pipeline are automatically printed on individual lines by the default PowerShell host.

Hooray for * doing string repetition.

# Fuzzy Octo Guacamole, 15 bytes

'*'25**25*!_[X]


Explanation:

'*'              # Push '*'
25*           # Push 10
*          # Multiply, leaves '**********' ('*'*10)
25*!_     # Sets the for-loop counter to 10 (2*5)
[X]  # Iterates 10 times and prints '********' each time


# Lua 36 bytes

print((("*"):rep(10).."\n"):rep(10))


There is already a Lua answer, but his was however not a full program that would print output and this one is shorter.

I wanted to post it as a comment to that one, but I don't have the reputation yet.

• On which interpreter does this print output? – Leaky Nun Aug 6 '16 at 4:02
• @LeakyNun Whoops, my bad. I tested it with the Lua 5.3 interpreter but I started it in interactive mode. I fixed the code so that it also runs in non interactive mode. – Seeseemelk Aug 8 '16 at 10:08

# Chef, 252 bytes

Was purely for fun trying to learn Chef.

Try it online!

a.

Ingredients.
42 b
10 c
10 d
13 e

Method.
Put e into mixing bowl.
F the c.
Put b into mixing bowl.
F the c until fed.
Liquefy contents of the mixing bowl.
G the d.
Pour contents of the mixing bowl into the baking dish.
G the d until ged.

Serves 1.

• Nice answer! Welcome to the site :) – James Dec 20 '17 at 21:10

# Lost, 15211611410595916057 54 bytes

66 bytes saved thanks to Jo King

v%<@(<<<<<<<<<<<<<<
\?\<>"**********h^"
/<>9v+^?:)-1+-


Try it online!

This program is unbelievably convoluted. I might explain it when I finished golfing it. For now here is a rough overview.

## Explanations

To the left we have

v%
\?\<


which catches and cleans the ip. It exits when ? fails to jump over \ pushing the ip down to

  (
>
>9v


which puts a counter set at 9 into the scope.

Then we push the string "**********h^". The ip wraps around to the other side and back down onto the next line moving backwards. The +- combines the last two characters to turn the h^ to a newline.

From here +^?:)-1 subtracts one from the counter or deflects the counter up to the top row if it is already zero. On its way to the top row * combines the two junk values we have lying around once on the top row we get rid of the last value with ( and exit with @.

• 62 bytes – Jo King Feb 6 '18 at 9:28
• @JoKing Nice! I'll add that as soon as I have a chance to fully digest all of your changes. – Wheat Wizard Feb 6 '18 at 14:12
• Sorry, but 60 bytes – Jo King Feb 6 '18 at 22:13
• @JoKing Ok I've updated the answer. Thanks – Wheat Wizard Feb 6 '18 at 22:37

# Backhand, 28 bytes

aH~0}|{:& [a ^v&v"*******" ^


Try it online!

It may seem weird that the quotes only contain 7 asterisks, but there's a reason for it.

### Explanation:

Note that the pointer usually moves in steps of 3

a         Push 10 as the counter
0 |{   Push 0 to not get reflected and enter the loop
&           Store the counter in the register
a        Push a newline
v v  Decrease the step value to 1
"*******"    Push 7 asterisks
^  Increase the step value to 2 and reflect
" * * * "    Push 3 asterisks
&   Restore the counter
^      Increase the step counter to 3
[         Decrement the counter
:    Duplicate the counter
}|      Repeat the loop if the counter is not zero
~     Otherwise, pop the excess copy of the counter
H      And terminate, printing the contents of the stack


# Charcoal, 4 bytes

Ｇ+α*


Try it online!

The code translates as: draw a filled polygon (Ｇ); give it four equal sides going in the four cardinal directions (+); each side should be 10 characters (α, a variable preinitialized to 10); use asterisks (*).

• – totallyhuman Sep 3 '17 at 23:01

# Cheddar, 24 bytes

print(['*'*10]*10).vfuse


'*'*10 builds the string **********.

Then, ['**********']*10 creates 10 copies of that string.

Then, vfuse joins by newline.

## Perl, 17 bytes

Requires -E at no extra cost.

say"*"x10for 0..9


### Usage

perl -E 'say"*"x10for 0..9'
**********
**********
**********
**********
**********
**********
**********
**********
**********
**********


Saved a byte thanks to @manatwork!

• Keywords may touch the preceding digits. – manatwork Aug 4 '16 at 12:27
• @manatwork Ahhh... I always forget that works, expecially as for0.. doesn't! Thanks! – Dom Hastings Aug 4 '16 at 12:29
• I literally typed out the same program :) – simbabque Aug 4 '16 at 14:14

# ><>, 35 bytes

ab*1-:?!v:20.
>'*'o72.~
^?%b;!?l<oa


Try it online!

# dc, 22 18 bytes

[**********]ddddff


Invoked in bash as

echo [**********]ddddff | dc


Explanation:

[**********] # This is dc's way of making a string, which is then pushed onto the stack
dddd         # d is for duplicate, so we duplicate it 4 times on the stack
ff           # print the whole stack twice, which contains 5 repetitions of 10 *'s (x2)


Thanks to LeakyNun for saving 5 4 bytes; Edited from 5 since I can't count.

• Ah, right! f doesn't clear the stack. Alternatively, ...dfffff would accomplish it as well with the same byte count. Come to think, ...ddfffp would work just as well (3 sets of three and then just one). There are a lot of ways to get 10 reps with 6 bytes. – Delioth Aug 4 '16 at 17:45

# C#, 53,122 108 bytes

Seeing that I'm seriously new to code golf... I'll give it a shot in c#

public class Program{public static void Main(){for (var i=0;i<10;i++)System.Console.Write("**********\n");}}


try it online

• for(var i=0;i++<10;)Console.Write("**********\n"); is shorter, also, you need a full program or function. – ASCII-only Aug 4 '16 at 11:08
• @MarsUltor - thanks for the feedback. As mentioned, I'm seriously new to this and not exactly sure what is allowed and what not. Could you please elaborate on full program? Would this include literary all the code, such as using, namespaces, main etc. Thanks! – Richard Bailey Aug 4 '16 at 11:12
• class a{static void Main{for(var i=0;i++<10;)Console.Write("**********\n");}} is acceptable (not entirely sure it works though, you should test it, maybe you need System before Console) – ASCII-only Aug 4 '16 at 11:21
• You can get rid of using System; and use System.Console.WriteLine("**********");. It saves you 6 bytes. Also, you can get rid of some spaces for extra savings - the ones around the for cycle. – auhmaan Aug 4 '16 at 17:23
• It's a shame Enumerable.Repeat() is so many bytes... C# could move up a lot of these with a shorthand for that function. – Joel Coehoorn Aug 8 '16 at 19:28

# Python 3, 25 23 bytes

Hey I actually outgolfed someone :).

print(("*"*9+"*\n")*10)


if stderr is valid, 22 bytes

exit(("*"*9+"*\n")*10)


realised that execing didn't actually golf it down :(

exec("print('*'*10);"*10)

Works by concatenating ten copies of print('*'*10); and execing, which in turn works by concatenating '*' 10 times and printing
• I think you're missing parentheses: print(("*"*9+"*\n")*10) – shooqie Aug 4 '16 at 9:46