# 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.

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.

• @DylanMeeus "You are to print this exact text:" Commented Aug 4, 2016 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. Commented Aug 4, 2016 at 12:58
• 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. Commented Aug 5, 2016 at 9:14
• you say trailing new lines are acceptable. Are leading newlines acceptable too? Commented Feb 10, 2017 at 2:34

# Desmos, 30 bytes

29sign(mod([1,...,110],11))+13


View it online! (kinda)

Desmos doesn't have string support, so instead we output a list of 110 character codes. If you don't want a trailing newline, you can change the 110 to a 109 with no issues. Desmos also doesn't support loops properly, but if you apply operations to arrays, it applies them to each element in the array. Explanation:

           [1,...,110]           Generate array containing numbers 1 to 110
mod(           ,11)       Find index mod 11 (0 corresponds to end of row)
sign(                   )      Coerce to 0/1 instead of 0/1/2/...
29                         +13   Convert 0s to 13s (\n in ASCII) and 1s to 42s (* in ASCII)


# GolfScript, 10 bytes

10."*"*n+*


Try it online!

10.         # Puts 10 on the stack and makes a copy of it
"*"*     # Puts the asterisk on the stack and multiplies it by the 10 to get "**********"
n+   # Adds a newline to the string
*  # Multiplies by that first 10


# Bubblegum, 8 bytes

00000000: d382 035e 2e7a b201


Try it online!

# JAISBaL 3.0.1, 9 bytes

h**A10«


Verbose:

# \# enable verbose parsing #\
ten            \# [0] push ten onto the stack #\
push1 *        \# [1] push * onto the stack #\
mul            \# [2] multiply the top two values of the stack #\
dupmany 10     \# [3] duplicate the top value of the stack 10 times #\
popoutallln    \# [4] pop off every value in the stack and print each one with a new line #\


### Conventional 10 byte version (using actual for loops):

˖˖S*˄P


Verbose:

# \# enable verbose parsing #\
ten                 \# [0] push ten onto the stack #\
for                 \# [1] start for loop #\
ten             \# [2] push ten onto the stack #\
for             \# [3] start for loop #\
print1 *    \# [4] print * #\
end             \# [5] end current language construct #\
ln              \# [6] print a new line #\


intepreter

## Check, 15 bytes

"*">10:r*R]+R*o


Pushes the string * and repeats it ten times, while also storing 10 in the register. Then adds 10 to the end of the string (a newline), then repeats the whole thing 10 times.

# Bound, 13 12 bytes

10:c42:d*@RS


Thanks to Razetime for the -1 byte
Explanation:

1 # Put 1 onto the stack [1]
0 # Put 0 onto the stack [1, 0]
: # Combine the top two elements [10]
c # Copies the top element [10, 10]
4 # Put 4 onto the stack [10, 10, 4]
2 # Put 2 onto the stack [10, 10, 4, 2]
: # Combine the top two elements [10, 10, 42]
d # Convert the top element into a char [10, 10, '*']
* # Multiply the top two elements [10, '**********']
@ # Sorts the stack ['**********', 10]
R # Repeat the next command n times, where n is top element (10) ['**********']
S # Print the top char/string (creates newlines)


Try it online!

• Welcome to the site and nice first answer! Commented Oct 14, 2020 at 15:51
• 12 bytes: 10:c42:d*@RS Commented Oct 14, 2020 at 16:03
• @cairdcoinheringaahing thank you! excited to be here Commented Oct 14, 2020 at 16:13
• @Razetime nice! Commented Oct 14, 2020 at 16:14

# Brian & Chuck, 23 bytes

*{-?
{..........>-.+?


Try it online!

The   is the ascii code 11.

Brian:
*      "*" 11
{-    Restart Chuck's code and subtract 1
?   Go to Chuck's code while the first byte is not 0

Chuck:
11 (This will be decremented by 1 each line)
{                  Restart Brian's code
..........        Print the "*" 10 times
>-.+    Print the newline
?   Go back to Brian's code


# Python 3, 67 bytes

print('\n'.join(''.join('*' for x in range(10))for y in range(10)))


Try it online!

• Welcome to the site, and nice first answer! Commented Dec 1, 2020 at 20:10
• 62 bytes by saving range(10) as a variable and removing the space after '*' Commented Dec 1, 2020 at 21:42
• Don't forget to check out existing Python solutions to this problem. The current record is 20 bytes (Python 2) / 22 bytes (Python 3). Commented Dec 1, 2020 at 23:24

# Zsh-F, 19 bytes

yes **********|head


Try it online!

Edit: just saw this exact answer was already posted for bash :(

• alt approach (22 bytes): jot -b'**********' 10 Commented Mar 15, 2021 at 1:55

# Java 11, 48 chars

for(int i=0;i++<10;out.println("*".repeat(10)));


Try it online!

# Java 5, 53 chars

Static imports

for(int i=0;i++<100;out.print("*"+(i%10>0?"":"\n")));


Try it online!

# Java 3, 60 chars

Plain old Java

for(int i=0;i++<100;System.out.print("*"+(i%10>0?"":"\n")));


Try it online!

# C (gcc), 41 bytes

main(n){++n<puts("**********")&&main(n);}


Try it online!

Or if you don't have any problem using a function that would work only the first time it's called (because to make it work again you should reset the value of n)

# C (gcc), 38 bytes

n=9;f(){puts("**********");n&&f(--n);}


Try it online!

And a 38 bytes dupe

n;f(){++n+1<puts("**********")&&f(n);}


Try it online!

Note that even the first code works only one time, it doesn't reset anything, you need to run the program again to have another 10x10 grid. However for some (questionable) reason they allow printing the grid just once per program run when using main, but not when using another function.

• This prints a 10*n grid of asterisks. Taking extra input (the 10 in this case) is not allowed Commented Jan 19, 2021 at 3:51
• @ppery fixed it, thank you so much Commented Jan 19, 2021 at 4:30
• Nope, your answer is now a non-reusable function, so still not allowed. Commented Jan 19, 2021 at 4:42
• Omg I am learning a lot from you! I will fix even this one Commented Jan 19, 2021 at 5:01
• @ppery resetting the global variable at the end of the function requires too much unnecessary code and I just want you to notice that this so upvoted answer codegolf.stackexchange.com/a/88695/100356 doesn't reset anything either, it requires a new run for every 10x10 block. And most probably the same thing happens in most codes here and in any codegolf question. I don't see any reason why we should use double standards. Commented Jan 19, 2021 at 17:37

# Lua, 31 bytes

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


Try it online!

Not very impressive but I think simpler is shorter in this case.

• can't seem to beat this :) Commented Nov 1, 2021 at 18:21

## Python 3, 26 24 bytes

print((10*'*'+'\n')*10)

• I'm new to coding and even newer to competitive programming, so don't go too hard on me :D Commented Jan 23, 2021 at 5:01
• Oh of course, multiplication has priority over addition. Thanks dude. Commented Jan 23, 2021 at 5:09

# Whispers v3, 38 bytes

> "**********"
>> Output 1
>> Each 2 1


Try it online!

# BRASCA, 26 24 20 17 bytes

l:[{$[{'*o]xllo$]


Try it online!

## Explanation

l:                   - Initialize stack
[             ]    - Do 10 times:
{$- Decrement and swap [ ] - Do 10 times: {'*o - Decrement and print * xllo$     -   Reset and print a newline


# Python - 40 20 23 bytes

 print(("*"*10+"\n")*10) # prints a row of 10 *s then a new line, 10 times


This (freshly optimised) code prints an asterisk 10 times, then a newline (should be fixed now), then repeats that 10 times.

• Well, a quick save would be with the asterisks, instead of print("**********"), try print("*"*10) and save 6 bytes. Online example here: tio.run/##K6gsycjPM/7/Py2/… Commented Mar 1, 2021 at 14:14
• You can also probably add a newline to the "*"*10, and then multiply that be ten as well Commented Mar 1, 2021 at 14:23
• Fixed now - thanks for the help. Commented Mar 1, 2021 at 14:59
• You don't define the variable n anywhere. Commented Mar 1, 2021 at 16:54
• Um, it doesn't work like that for me. I get NameError: name 'n' is not defined running this code on both Python 2 and Python 3 Commented Mar 2, 2021 at 15:09

# Templates Considered Harmful, 89 bytes

Ap<Fun<If<A<1>,Cat<St<42,42,42,42,42,42,42,42,42,42,10>,Ap<A<0>,Sub<A<1>,T>>>,LF>>,I<10>>


Try it online!

Pretty standard "10 stars 10 times" answer, in the form of a tail-recursive anonymous function.

Ap<
Fun<
If<A<1>,
Cat<
St<42,42,42,42,42,42,42,42,42,42,10>,
Ap<A<0>,
Sub<A<1>,I<1>>>>,
LF>>,
I<10>
>


# naz, 44 40 bytes

crossed out 44 is still regular 44 :(

1x1f6a7m9o1o4d1o0m0x1f1f1f1f1f1f1f1f1f1f


This is another one of those cases where a truly recursive definition would actually use more bytes than just repeating the f instruction.

Saved 4 bytes by using division instead of subtraction!

Try it online!

Explanation (with 0x instructions removed)

1x1f                   # Function 1
6a7m9o1o           # Output 10 asterisks
4d1o       # Output a newline
0m     # Reset the register
1f1f1f1f1f1f1f1f1f1f   # Call function 1 ten times


# JavaScript (V8), 31 bytes

write(**********
.repeat(10))


Try it online!

# Java (JDK), 37 bytes

out.print("**********\n".repeat(10));


Try it online!

# Clojure, 35 bytes

(dotimes[_ 10](print"**********
"))


Try it online!

# Elixir, 35 bytes

for _<-0..9,do: IO.puts"**********"


Try it online!

# VBScript, 39 bytes

For i=0 to 9
WSH.Echo "**********"
next


# VBScript, 53 bytes

For i=0 to 9
WSH.Echo replace(space(10)," ","*")
next


The second solution is slightly more interesting......

# ConTeXt (40 bytes)

Compile it here (note that the magic comment is only here for texlive.net and it's not needed in an offline compilation).

\let~\dorecurse\starttext~{10}{~{10}*\\}


# Twue, 31 bytes

a::~**********\n
::=
aaaaaaaaaa

Try it on the website!

Simply defines the replacement a which maps to printing 10 asterisks. The main body consists of 10 as. Trying a secondary replacement b::=aa or b::=aaaaa both yield 33 bytes, which is unfortunately longer.

Whereas in some Thue interpreters, outputting implicitly outputs a newline, that is not the case in Twue, which must manually insert the newline.

# Duocentehexaquinquagesimal, 18 bytes

hùyy₄āÆβUW:“ã¾8½ž+


Try it online!

# BRASCA, 14 bytes

l[ll['*o{]xo{]


Try it online!

# yuno (abandoned), 11 bytes

」＊１０リュ」ニュア１０リュ


xxd using Jelly's codepage:

00000000: f8f6 e6e5 5bf8 5200 e6e5 5b              ẏẇȧẓ[ẏR¡ȧẓ[


## Explanation

」＊　　　　　　　　　　　　    push "*"
１０　　　　　　　　　　    push 10
リュ　　　　　　　　    repeat "*" 10 times
」ニュ　　　　　    push "\n"
１０　　    push 10
リュ    repeat "**********\n" 10 times


Equivalently written as ]*10ryu]nyua10ryu

# PPL, 33 bytes

loop10{
printLine("**********")
}


There is no concept of repeating strings, and the * operator is not overloaded with strings by numbers, so I hardcoded a string of 10 asterisks and printed it 10 times using the loop keyword.

# Mathematica, 24 bytes

Print@@@Table["*",10,10]


A second (simple) Mathematica proposition, same length