Looping counter
Looping counter
Create an infinite loop that outputs lines of asterisks, with each line containing one more asterisk. Instead of the asterisk, any printable, non-whitespace character can be used. However all lines need to use the same character.
The beginning of the output looks like this:
*
**
***
****
*****
******
*******
********
*********
**********
***********
************
An ungolfed Python implementation:
from itertools import count
for i in count(1):
print('*'*i)
Lua, 31 bytes ``` =''::::=.. …
2y ago
Vyxal, 5 4 bytes ``` ¤{‹… …
2y ago
[Ruby], 18 bytes lo …
2y ago
MATL, 16 bytes ``` 1`1yh1$ …
2y ago
Haskell, 35 bytes main=mapM …
2y ago
[brainfuck], 31 bytes + …
2y ago
[K (oK)], 9 bytes {x#0} …
3mo ago
C, 30 + 1-4 byte f(m){f …
1y ago
Fig, 5 bytes The actual score …
2y ago
Japt, 6 bytes ßOpP±Q …
2y ago
JavaScript, 25 bytes Could …
2y ago
J, 13 char ``` '',^:(<)'' ` …
2y ago
[C (gcc)], 47 bytes …
2y ago
[JavaScript (Node.js)], 31 byt …
2y ago
Embed ESCR, about 32 character …
2y ago
[><>], 10 bytes 1:naoa1 …
2y ago
[dc], 13 bytes [r1+pArd …
2y ago
[Bash], 17 bytes ec …
2y ago
[Python 2], 26 bytes …
2y ago
[Python 3], 28 bytes …
2y ago
[AWK], 26 24 bytes END{ …
6mo ago
21 answers
Embed ESCR, about 32 characters depending on how you count
loop append s "*" show s endloop
The indentation is not required, but shown for clarity. Declaring the variable S is also not included, since similar stuff doesn't seem to be included in other examples.
S is a string variable. In ESCR, storage for a string can grow dynamically at run time as needed. The string initialially starts empty, with one "*" appended to it each iteration.
0 comment threads
- ← Previous
- 1
- 2
- Next →
2 comment threads