# 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:" 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. Aug 4 '16 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. Aug 5 '16 at 9:14
• you say trailing new lines are acceptable. Are leading newlines acceptable too? Feb 10 '17 at 2:34

# Gol><>, 9 bytes

aFa:R*|H


There is a trailing newline, but the specs say it is okay. Below is a version that doesn't have a trailing new line, but adds on 2 extra bytes.

aFaR*a|~rH


Try it online!

# C# (.NET Core), 53 bytes

Brand new to code golf, is this type of format allowed to be used (Usage of the header section / footer section)?

for(int i=0;i<10;i++){Console.Write("**********\n");}


Try it online!

• Welcome to PPCG, and Great First Answer Feb 19 '19 at 22:46
• You can get it down to 49 bytes by moving the i++ into the conditional expression, and moving the block body into the increment statement: for(int i=0;i++<10;Console.Write("**********\n")); (try it online) Feb 20 '19 at 14:47
• This is not valid since it's neither a function (lambdas count) nor is it a full program. With a few adjustments though, 42 Feb 20 '19 at 16:29
• @mgthomas99 btw that's 50 bytes, and it makes no difference whether the write is inside or outside Feb 20 '19 at 16:30

## Perl 5, 18 Bytes

say'*'x10for 1..10


Requires the -E flags, as in:

perl -E "say'*'x10for 1..10"


# Forth (gforth), 36 34 bytes

: f 9 for ." **********" cr next ;


Try it online!

-2 bytes thanks to @bubbler

### Explanation

 10 0            \ put 10 and 0 on the stack
do              \ begin a loop from 0 to 10 (0 inclusive 10 exclusive)
." **********"  \ print the string literal ********** (the initial space is required because forth words are space separated, and ." is not an exception)
cr              \ print out a new line character
loop            \ end the loop

• Using for..next loop is 2 bytes shorter: Try it online! Oct 12 '19 at 8:13

# Keg, 10 bytes

(
|(
|\*)
)


## Explanation

(\n|           Start for loop iterating 10 times
(\n|       Start for loop iterating 10 times
\*     Push an asterisk
)    End loop
\n  Push a newline


Try it online!

• Apparently the final ) is not needed, only the newline in front of it. At least for the TIO version. Oct 14 '19 at 14:20

# JAPT, 12 bytes

'*
pA)+R
VpA


Japt sets vars automatically, so '* sets U to "*" pA)+R prints U out A(10) times. And adds a new line (+R). All this is set to V. VpA prints V out A times

In Regular JS is

U = "*";
V = (U.p(A)) + R;
V.p(A)


# MAWP, 26 bytes

%25W[25W[~67W;~1A]%25W;1A]


This was interesting.

Try it!

• You have no use for the % at the start and two stack reversals, essentially leading you to my answer codegolf.stackexchange.com/a/209467/92080
– Dion
Aug 12 '20 at 18:20
• Really should stop spamming the stack reversal everywhere. Aug 13 '20 at 2:05

# 1+, 2562556461595650 48 bytes

10
42
..(|(A|";";";";";)(A)^";^)(B|()()())(B)(B)


I'm lazy. Pushes a newline and an asterisk, then simply output them, without any tricks. No loops because creating terminating loops in 1+ is painful.

EDIT: -1 byte by reusing the constant 2.

EDIT: -191 bytes by using functions.

EDIT: -3 bytes by using another function.

EDIT: -2 bytes using one more function.

EDIT: -3 bytes.

EDIT: -6 bytes, although it probably doesn't quite follow the rules. It outputs number:  followed by the correct output, but number:  is a input prompt. If the input prompt have to be counted as output, then all answers with input is invalid as well.

This exploits a weird behaviour of the interpreter. When run in TIO with argument .input.tio, it reads from the input for the program source code and reads from the input again for the program input. So, yeah, the source code is fed into the input itself. 42 is a nope NOP because the only number literal 1+ recognises is 1. . pushes the input as an integer, which is 42.

If the character was something other than * it can be 46 bytes, by reading a character, not integer (* cannot precede the program due to the empty stack)

This will be completely valid after TwilightSparkle Edition is out. (TSE have a "-o" command line option that runs the original interpreter, except there are no prompts.)

EDIT: -2 bytes. Same trick with 10.

# INTERCAL, 197 185 bytes

DO,1<-#11DO,1SUB#1<-#172DO,1SUB#11<-#260PLEASEREADOUT,1DO,1SUB#1<-#252PLEASEREADOUT,1DOREADOUT,1DOREADOUT,1DOREADOUT,1DOREADOUT,1DOREADOUT,1DOREADOUT,1DOREADOUT,1DOREADOUT,1PLEASEGIVEUP


Try it online!

Looping is ~120 bytes longer...

Fills an array with tape instructions for one line, prints that, overwrites the first instruction with a new one relative to the new tape position, prints that nine more times.

### EDIT

I used one PLEASE too much, also READ OUT and GIVE UP don't require a DO between the PLEASE and themselves, saving some bytes.

# Rockstar, 53514137 35 bytes

X's10
while X
say "*"*10
let X be-1


Try it here (Code will need to be pasted in)

# MAWP, 23 bytes

25W[25W[67W;1A]%52W;1A]


Try it!

Two nested loops doing almost the same thing

# MAWP 2.0, 20 bytes

10[10["*":1-]10;1-]


Try it!

Basically the same thing

+42
y:10
Fy,Fy,,h,hy


Try it online!

Somehow -2 thanks to cairdcoinheringaahing

# PyMin, 14 bytes / 10 characters

»("*"Ҁ+ѿ)Ҁ


Shorter version with v0.5:

### 13 bytes / 9 characters:

»("*"ҀƜ)Ҁ

• The repository was deleted.
– user85052
Nov 7 '19 at 10:07

# Braingolf, 18 bytes

8V9R#*[.]#
[R&!@v]


Try it online!

## Explanation:

8V9R#*[.]#\n[R&!@v]
8                    Push 8
V                   Create stack2 and switch to it
9                  Push 9
#*               Push codepoint of *
[.]            Do-while loop, will run 9 times due to the 8 pushed at the start
.             Duplicate last item on stack
#\n         Push codepoint of newline
[R...v]  Do-while loop, uses stack2 for loop counting
Will run 10 times due to the 9 pushed at the start
&!@    Print entire stack1 without popping

• 15 bytes Jun 16 '17 at 8:00

# Marbelous, 81 bytes

@0
0A
>0\/
--
&0@1
&10B
@0&0
@1/\@2
@3@2
--/\\\..@4
>0&1&1/\&2
&2\/--@4/\s*
@3
:s*
2A
{0


Marbelous is a language based on marble machines

this program is composed of 4 subparts :

### the main loop

a while loop going from 10 to 0, realease &0, and wait for &1 to be released before continuing

@0
0A
>0 \/
--
&0
&1
@0


### the 11(0B) generator

a structure sending 11 (0B) to the portal @2 when the synchroniser group &0 is released

.. @1
.. 0B
.. &0
@1 /\ @2


### the printer

a while loop waiting for something in @2 it then print that value minus 1 asterisk finish by printing the ascii value of @2-1 (which is 10(\n) here) and release synchroniser &1

@3 @2
-- /\ \\ .. @4
>0 &1 &1 /\ &2
&2 \/ -- @4 /\ s*
@3


### asterisk creator

board transforming the inputted marble into a 2A (ascii value of *)

:s*
2A
{0


## used language built-in are :

• .. is a noop
• 00-FF initiate a marble with this value
• @n (n from 0 to Z) is a portal which teleport the marble to another portal with the same value
• &n (n from 0 to Z) is a synchroniser, hold the marble until all corresponding synchroniser (same n) are full
• \/ is a trash can
• /\ create a duplicate passing marble to it's left and right
• marbles going out of the machine from the bottom are implicitly outputed
• -- is a decrement
• \\ is a right deflector, the marble go right
• >n (n from 0 to Z) is a conditional, if marble > n then noop else go right

### boards

it also uses a board, boards are created with :name at the start of a new line with name being anything you want, they have special built-in

• }n (n from 0 to Z) input argument
• {n (n from 0 to Z) returned output

Boards execution pause the caller execution until finished

interpretor

# CJam, 8 bytes

'*A*N+A*


Explanation:

'*          Push an asterisk
A*        Multiply by 10
A*    Multiply by 10
Implicitly output


*<Ctrl-Shift-R><Ctrl-A><Ctrl-D><Ctrl-D><Ctrl-D><Ctrl-D><Ctrl-A><Ctrl-D><Ctrl-Shift-R><End><Enter><Ctrl-Shift-P>


Saved two keystrokes by using a macro. Explanation to come.

### Original code and explanation

*****<Ctrl-D><Del><Ctrl-D><Ctrl-D><Ctrl-D><Ctrl-D><Ctrl-A><Ctrl-D>→<Enter>


We start by inserting five asterisks. CtrlD duplicates this line, leaving the cursor at the end of the first line. Del removes the newline, so now we have a line of ten asterisks.

Four applications of CtrlD give us five lines of asterisks. Next, CtrlA CtrlD duplicates all five lines at once, but it doesn't include a newline between the copies:

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


Fortunately, the first half is still selected, so if we press , the cursor will be immediately after the tenth asterisk on the too-long line, and we can add the missing newline with Enter.

# GNU nano, 14 keystrokes

<C-6>*<C-K><M-:><C-U><C-U><C-U><C-U><C-U><M-:><M-;><C-K><M-;><M-;>


<C-X> refers to CTRL+X, <M+X> refers to META+X.

### Explanation

<C-6>         Start a selection block
*             Type an asterisk (typing does not affect the selection by default)
At this point, '*' is selected.
<C-K>         Delete the selection and put it into the cutbuffer. '*'
<M-:>         Start recording a macro
<C-U> (5x)  Paste 5 times, text is now '*****'
<M-:>         Stop macro recording. Macro pastes 5 times now.
<M-;>         Run the macro, pasting 5 more '*'s. Text is now '**********'
<C-K>         Delete the current line and put it in the cutbuffer. '**********\n'
<M-;><M-;>    Run the macro twice, pasting '**********\n' 10 times


Betcha didn't know nano had macros?

Video demo (done in Termux because of visible keyboard, --ignorerc just ignores any RC files that may alter the behavior)

# Batch, 42 bytes

@for /l %%a in (1,1,10) do echo **********


# vJASS (Warcraft 3), 100 76 bytes

Using //! import zinc "<code_path>" command to exclude //! zinc and //! endzinc.

library q{real w;function onInit(){for(0<=w<10){BJDebugMsg("**********");}}}


• Would you mind slowing down a bit on updating your answers, maybe wait for an hour or so before doing some more? The recently active page is getting flooded with older questions because of the edits, and it'd be good to let it settle down a bit Mar 11 at 22:44
• @ChartZBelatedly oh, okay. Sorry for my unintentional spam. Mar 11 at 22:47
• No worries, just thought it'd be worth letting you know :) Mar 11 at 22:48

# Python 3, 23 bytes

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


Try it online!

# R, 39 bytes

cat(c("*","\n")[(0:219)%%21/10],sep='')


Don't know if R coercing indices to integer is commonly used, so thought it worth posting in case someone can do something extra with it!

• Sure, navigating among so many answers is a nightmare, but different variations of doing this in R were extensively discussed here. Mar 15 at 9:55
• Fair point @KirillL. and I would have posted a comment but didn't have the reputation yet - ironically, posting the new answer has given me some of the reputation I need to do it... Mar 15 at 21:17

# 05AB1E, 7 bytes

'*T×TF,


Try it online!

'*T×TF,  # full program
'*T×     # push "**********"
TF   # repeat 10 times...
,  # output top of stack to STDOUT
# (implicit) exit loop


# 05AB1E, 7 bytes

'*т×Tä»


Try it online!

'*т×Tä»  # full program
»  # join....
т×     # 100...
'*       # asteriks...
ä   # split into...
T    # 10...
ä   # pieces...
»  # by newlines
# implicit output


# CSASM v2.3.0.1, 50 bytes

func main:
push "**********\n"
push 10
mul
print
ret
end


mul duplicates a <str> value by a given <i32> amount, concatenating the copies together

# GFortran, 31 29 bytes

print'(10A)',('*',j=0,99)
end


The loop ('*',j=0,99) spits out 100 *s. Formatting directive '(10(A))' '(10A)' wraps it.

try it online!

31 bytes

• this shows that (fortran.ge.javascript) Mar 15 at 1:22
• FWIW Gnu f95 doesn't is happy with this print'(10A)',('*',j=0,99) as the print line, meaning it does the right thing with 10A instead of 10(A), which drops 2 more characters. Mar 24 at 6:39

# Excel, 10 8 keystrokes

In a fresh empty sheet,

Ctrl+GJ10EnterCtrl+Shift+Home*Ctrl-Shift-Enter

Explanation:

• Ctrl+G is a shortcut for the GoTo dialog
• Entering J10 goes to that cell
• Enter closes the dialog
• Ctrl+Shift+Home expands the selection to A1, making a grid of 10x10 cells
• Then we put in the asterisk
• Ctrl+Shift+Enter (instead of plain Enter) fills in the input over all selected cells

# PHP, 69 Bytes

<?for($i=1;$i<101;$i++){if($i%10!=0){echo('*');}else{echo('*<br>');}}


# Vyxal, 8 bytes

\*₀*¶+₀*


Try it Online!

-1 due to cairdcoinheringaahing

Later I reduced another one

• -1 byte Apr 25 at 17:19
• @cairdcoinheringaahing thax! Apr 25 at 17:20
• here's how to do it in 4 bytes. But I recommend you keep this because it is flagless Apr 26 at 2:36
• Flagless, ₀(\*₀*, May 14 at 8:54

# Barrel, 14 13 bytes

^42#10(#10p¶


Explanation:

^42          // push 42 to the accumulator
#10       // do 10 times...
(      // defines a code block which becomes a single instruction
// (the parenthesis is self-closing)
#10p  // print the accumulator as an ASCII character 10 times
¶ // print a newline


EDIT: removed the closing parenthesis, saving 1 byte, since I found the reason hadn't been able to get it to work right (I had added a newline at the end of my test file! *sigh*).

# Yggdrasil, 105 bytes

;*
""""""""":""""""""":""""""""":""""""""":""""""""":""""""""":""""""""":""""""""":""""""""":""""""""""


Try it online!

The first few characters set up the memory tree for the program:

   ;
/ \
*  \n


Yggdrasil has the = command for loops, but it unfortunately doesn't work. The only looping it can do is recursively call itself until it hits the recursion limit, so we have to print everything manually. The " command prints the left branch, which is *, and the : command prints both the left and the right branches, which are *\n`