[Question]
  [
Inspired by a task for Programming 101, here's a challenge that hopefully isn't too easy (or a duplicate).
## Input:
* A positive integer `n >= 1`.
## Output:
* `n` lines of asterisks, where every new line has one asterisk more than the line before, and starting with one asterisk in the first line.
## Test case (n=5):
```
    *
    **
    ***
    ****
    *****
```
This is [code-golf](/questions/tagged/code-golf "show questions tagged 'code-golf'"), so shortest answer in bytes wins.
  
[Answer]
# Vim, 8 bytes
```
o <Esc><C-V>{r*J
```
Takes input in the readahead buffer, so if input is 15, you would type that and then the code above. This is a silly rule, but *seems* to be [allowed](http://meta.codegolf.stackexchange.com/a/8580/60590). If you got input in a register like `"a`, you'd just stick `@a` in front (10). If you got it from the start file, you'd prepend `D@"` instead (11).
Relies on abuse of `:set autoindent`, which is default in [vimgolf.com](https://www.vimgolf.com/) rules and default in Vim 8 (and everyone uses it anyway).
* `o <Esc>`: With its number argument, if your text starts with whitespace, and you have `:set autoindent`, Vim glitches out and creates a cascade of indent.
* `<C-V>{r*`: Turn all those spaces into `*`s. I'm using block visual so that, even if your lousy indent settings silently group your spaces into tabs, you'll still get the right number of `*`s.
* `J`: Starting with `o` unfortunately left a blank line at the top. This removes it.
[Answer]
# JavaScript (ES6), 31 bytes
This one includes both a leading and a trailing line-break.
We start with a string `s` containing only a line-break. Then we process `n` recursive calls, adding an asterisk on the left side of this string at each iteration. The concatenation of all intermediate strings leads to the expected result.
```
f=(n,s=`
`)=>n?s+f(n-1,'*'+s):s
```
[Try it online!](https://tio.run/##y0osSyxOLsosKNHNy09J/f8/zVYjT6fYNoErQdPWLs@@WDtNI0/XUEddS127WNOq@H9yfl5xfk6qXk5@ukaahqmm5n8A "JavaScript (Node.js) – Try It Online")
### Without asterisk, 36 bytes
```
f=(n,s=`
`)=>n?s+f(n-1,atob`Kg`+s):s
```
[Try it online!](https://tio.run/##FczLDsIgEEDRfb9idkD6iom60FATtyZu/AFoCy0GmYbB19ej3d9z7/qlaYhuSXXA0eS2hQX91zrvwWIEnbDnooL37IYZRjQUWALzcZTABbj@TbE2IIFAdnB@WmtiYyM@OEEJjFXAek1mv2WiSXhL0YWJi2O2koeKpCqUkF04UWl5qDfVOlOXSZUkDpQHDITeNB4nbvlOiPwD "JavaScript (Node.js) – Try It Online")
[Answer]
# [05AB1E](http://github.com/Adriandmen/05AB1E), ~~7~~ 6 bytes
Uses [CP-1252](http://www.cp1252.com/) encoding.
```
'*×.p»
```
**8 byte no-asterisk version:**
```
žQTè×.p»
```
[Try it online!](http://05ab1e.tryitonline.net/#code=JyrDly5wwrs&input=NQ)
**Explanation**
Example using input `n = 5`
```
'*      # push "*"
        # STACK: "*"
  ×     # repeat input number times
        # STACK: "*****"
   .p   # get prefixes of string
        # STACK: ['*', '**', '***', '****', '*****']
     »  # join by newlines
        # implicit print
```
[Answer]
# [PowerShell](https://github.com/TryItOnline/TioSetup/wiki/Powershell), ~~21~~ 20 bytes
```
1.."$args"|%{'*'*$_}
```
[Try it online!](https://tio.run/##K8gvTy0qzkjNyfn/31BPT0klsSi9WKlGtVpdS11LJb72////pgA "PowerShell – Try It Online")
Loops from `1` to input `$args`, each iteration using string multiplication to construct a string of that many `$_` asterisks. Default behavior for the implicit `Write-Output` at the end is with a newline for separator, so we get that for free.
```
PS C:\Tools\Scripts\golfing> .\draw-asterisk-pattern.ps1 5
*
**
***
****
*****
PS C:\Tools\Scripts\golfing> .\draw-asterisk-pattern.ps1 2
*
**
PS C:\Tools\Scripts\golfing> .\draw-asterisk-pattern.ps1 7
*
**
***
****
*****
******
*******
```
*-1 byte thanks to Veskah.*
[Answer]
# Python 2, ~~37~~ 34 bytes
```
i=1;exec"print'*'*i;i+=1;"*input()
```
**[Ideone](http://ideone.com/DQccQT)**
`i` is initialised to `1`;  
then `exec` commands to execute the following string of code, so it must be constructed;  
the string is `"print'*'*i;i+=1;"` but the `*` following the string takes precedence over the `exec` and instructs to first repeat the string `input()` times;  
the `exec` command now executes the long string which acts like a loop, `print`ing another string of increasing length, again using `*` to repeat the character `'*'`, then incrementing `i` with `i+=1`.
**Python 3, 41 bytes:**  
`def f(n):i=1;exec("print('*'*i);i+=1;"*n)`; or  
`lambda n,i=1:exec("print('*'*i);i+=1;"*n)`
[Answer]
# [Jelly](https://github.com/DennisMitchell/jelly), ~~6~~ 5 [bytes](https://github.com/DennisMitchell/jelly/wiki/Code-page)
```
”*ẋþY
```
**[TryItOnline](http://jelly.tryitonline.net/#code=4oCdKuG6i8O-WQ&input=&args=MTk)**
### How?
```
”*ẋþY - Main link: n
”*    - literal string "*"
   þ  - form outer product with the dyadic function:
  ẋ   -     repeat list (right input is an implicit range(n), Jelly defaults to 1-based)
            so the outer product is like:
            [[i*'*' for i in range(1,len("*")+1)] for x in range(1,n+1)]
    Y - join with line feeds
      - implicit print
```
---
Bounty:  
I'm not sure what the no ordinals clause is, since a character *is* a lookup of an ordinal.  
Direct lookup would just be `42Ọẋþ³Y` for **[7 bytes](http://jelly.tryitonline.net/#code=NDLhu4zhuovDvsKzWQ&input=&args=MTk)** - where the `³` gets us the input)  
A short slightly indirect method would be, for **[8 bytes](http://jelly.tryitonline.net/#code=4oCcKeKAmeG7jOG6i8O-wrNZ&input=&args=MTk)**, `“)’Ọẋþ³Y` - where we lookup `')'` in jelly's code page, which is 1-indexed so `“)’` yields 42.
[Answer]
# C#, 42 bytes
```
f=n=>n<1?"":f(n-1)+"\n"+new string('*',n);
```
Full program with test case:
```
using System;
namespace DrawAnAsteriskPattern
{
    class Program
    {
        static void Main(string[] args)
        {
            Func<int,string>f= null;
            f=n=>n<1?"":f(n-1)+"\n"+new string('*',n);
            
            Console.WriteLine(f(5));
        }
    }
}
```
[Answer]
# [Pyth](https://github.com/isaacg1/pyth), 6 bytes
```
j._*"*
```
[**Try it here**](http://pyth.herokuapp.com/?code=j._%2a%22%2a&input=5&debug=0).
### Explanation
```
j            Join by newlines
 ._          all prefixes of
    *        the result of repeating
      "*     the string "*"
             as many times as the implicit input 
```
[Answer]
# [GNU sed](https://www.gnu.org/software/sed/), ~~25~~ ~~24~~ 20 + 1(n flag) = 21 bytes
*Edit:* 4 bytes less based on [Riley](/users/57100/riley)'s comments
```
x;G;:;P;s:\n.:*\n:;t
```
**[Try it online!](http://sed.tryitonline.net/#code=eDtHOzo7UDtzOlxuLjoqXG46O3Q&input=MDAwMDA&args=LW4)**
**Run example:** the input is in unary format, which for sed is allowed based on this [consensus](http://meta.codegolf.stackexchange.com/questions/5343/can-numeric-input-output-be-in-unary "unary")
```
me@LCARS:/PPCG$ sed -nf draw_triangle.sed <<< "0000"
*
**
***
****
```
A leading newline is present in the output, but this is allowed by the OP.
**Explanation:**
```
x;G             # prepend a newline to unary string
:               # start loop
   P            # print first line only
   s:\n.:*\n:   # shift one unary char from 2nd line to 1st, converted to a '*'
t               # repeat
```
[Answer]
# Matlab, 26 23 bytes
Good old Matlab...
```
@(n)tril(repmat('*',n))
```
Has trailing whitespaces. `tril` gives you the lower triangular matrix.
edit: saved 2 bythes thanks to Luis Mendo
[Answer]
# C++ - 92 96 Bytes
```
#include<string>
int main(){int n;std::string s;scanf("%d",&n);for(;n--;)puts((s+="*").data());}
```
[Try it online](https://ideone.com/LiziXt)
Ungolfed:
```
//this one hurts, but c++ strings are mutable
#include<string> 
int main(){
    int n;
    //this one hurts as well
    std::string s; 
    //read input to n
    //longer than 'std::cin>>n', but no #include<iostream> needed
    scanf("%d",&n); 
    // same as 'while(n--)', also characterwise, but way cooler
    for(;n--;) 
        //add a '*' the string
        //data() does the same as c_str()
        //puts automatically adds an '\n'
        puts((s+="*").data()); 
}
```
[Answer]
## [Jellyfish](http://github.com/iatorm/jellyfish), ~~12~~ ~~11~~ 9 bytes
```
\P$'*
  i
```
[Try it online!](http://jellyfish.tryitonline.net/#code=XFAkJyoKICBp&input=NQ)
### Explanation
The above program is equivalent to the following functional pseudocode:
```
\            P      $       i        '*
map_prefixes(print, reshape(input(), '*'))
```
The `$` (reshape) creates a string of `N` asterisks. `\P` creates a function which takes a list (or string) and passes each of its prefixes to `P` (print). Hence, this successively prints strings of `1` to `N` asterisks.
[Answer]
## R, 45 bytes
For loop approach:
```
for(i in 1:scan())cat(rep("*",i),"\n",sep="")
```
[Answer]
# Haskell, 35 ~~38~~ bytes
List comprehension thanks to nimi:
```
f x=unlines[[1..n]>>"*"|n<-[1..x]]
```
Old version:
```
f 0=""
f n=f(n-1)++([1..n]>>"*")++"\n"
```
Alternate version:
```
g n=([1..n]>>"*")++"\n"
f n=[1..n]>>=g
```
[Answer]
# [Brachylog](http://github.com/JCumin/Brachylog), 12 bytes
```
yke:"*"rj@w\
```
[Try it online!](http://brachylog.tryitonline.net/#code=eWtlOiIqInJqQHdc&input=NQ)
This assumes that a trailing new line is acceptable
### Explanation
```
yk                The range [0, …, Input - 1]
  e               Take one element I of that range
   :"*"rj         Juxtapose "*" I times to itself
         @w       Write that string followed by a new line
           \      False: backtrack to another element of the range
```
### No trailing new line, 15 bytes
```
-:"*"rj:@[f~@nw
```
[Try it online!](http://brachylog.tryitonline.net/#code=LToiKiJyajpAW2Z-QG53&input=)
This one works by taking all prefixes of `"*" × Input`.
[Answer]
# Pyth, 7 Bytes
```
VQ*\*hN
```
Knocked off a byte thanks to **@ETHproductions**
[Try it online](https://pyth.herokuapp.com/?code=VQ%2a%5C%2ahN&input=5&debug=0)
# **using @PIetu1998's Technique**
**6, bytes**
```
j*L*\*S
```
[Answer]
# [2sable](http://github.com/Adriandmen/2sable), ~~24~~ 11 bytes
```
>G')Ç>çJN×,
```
[Try it online!](http://2sable.tryitonline.net/#code=PkcnKcOHPsOnSk7Dlyw&input=NA&debug=on)
And no sign of any asterisks! Golfed from 24 to 11 thanks to [@Emigna](https://codegolf.stackexchange.com/users/47066/emigna).
Explanation:
```
>G')Ç>çJN×,
>            Push input+1
 G           For N in range (1,input+1)
  ')Ç>çJ     Push '*' by getting ascii code for ')' and adding 1
        Nx,  Print '*' repeated N times
```
[Answer]
# [Brain-Flak](https://github.com/DJMcMayhem/Brain-Flak) 75 Bytes
Includes +3 for `-A` 
```
{(({})[()]<{({}[()]<(((((()()()){}()){})){}{})>)}{}((()()()()()){})>)}{}
```
[Try it online!](http://brain-flak.tryitonline.net/#code=eygoe30pWygpXTx7KHt9WygpXTwoKCgoKCgpKCkoKSl7fSgpKXt9KSl7fXt9KT4pfXt9KCgoKSgpKCkoKSgpKXt9KT4pfXt9&input=MTA&args=LUE)
---
**Explanation:**
```
{(({})[()]<                                                        >)}
#reduce the top element by one until it is 0 after doing the following
#Push this element back on to act as a counter for the next step.
#(counts down from input to 0 we'll call this counter)
           {({}[()]<                          >)}
           #reduce the top element by one until it is 0 after doing the following
           #(counts down from counter to 0)
                    (((((()()()){}()){})){}{})  
                    #push 42 (the ASCII code for *)
                                                 {}
                                                 #pop the counter used to push
                                                 #the right number of *s
                                                   ((()()()()()){})
                                                   #push a 10 (newline)
                                                                      {}
                                                                      #pop the null byte
```
[Answer]
# [Dyalog APL](https://dyalog.com), 8 [bytes](http://meta.codegolf.stackexchange.com/a/9429/43319)
```
↑'*'⍴⍨¨⍳
```
`↑` matrify the list consisting of
`'*'` the string "\*"
`⍴⍨` reshaped by
`¨` each of
`⍳` the integers 1 through the argument.
[TryAPL online!](http://tryapl.org/?a=f%u2190%u2191%27*%27%u2374%u2368%A8%u2373%20%u22C4%20f%A81%202%203%204%205&run)
[Answer]
# [V](http://github.com/DJMcMayhem/V), 8 bytes
```
Àé*hòlÄx
```
[Try it online!](http://v.tryitonline.net/#code=w4DDqSpow7Jsw4R4&input=&args=NQ)
[Answer]
# JavaScript (ES6), 34 bytes
```
f=x=>x?f(x-1)+`
`+'*'.repeat(x):''
```
[Answer]
# [Perl 6](https://perl6.org), 23 bytes
```
{.put for [\~] '*'xx$_}
```
( If the output is allowed to be a list of "lines" without newlines `.put for` can be removed )
## Explanation:
```
# bare block lambda with implicit parameter ｢$_｣
{
  .put            # print with trailing newline
    for           # for every one of the following
      [\~]        # produce using concatenation operator
        '*' xx $_ # list repeat '*' by the input
}
```
( See documentation for [`produce`](https://docs.perl6.org/routine/produce) if you don't understand what `[\~] ...` is doing )
[Answer]
# Perl 5, 22 20 bytes
```
say"*"x$_ for 1..pop
```
Run it with the `-E` switch to get `say`.
```
$ perl -E 'say"*"x$_ for 1..pop' 5
*
**
***
****
*****
```
Written out as a full program it would look like this:
```
use strict;
use feature 'say';
# get the argument
my $limit = pop @ARGV;
foreach my $i (1 .. $limit) { 
    say "*" x $i; 
}
```
* `shift` and `pop` implicitly work on `@ARGV` (the list of arguments) outside of subs
* `..` is the [range operator](http://perldoc.perl.org/perlop.html#Range-Operators)
* [`say`](http://perldoc.perl.org/functions/say.html) includes a newline
* `x` is an operator to repeat strings and is [explained in perlop](http://perldoc.perl.org/perlop.html#Multiplicative-Operators)
[Answer]
## Perl, 19 bytes
*-4 bytes thanks to [@Ton Hospel](https://codegolf.stackexchange.com/users/51507/ton-hospel) and his rework of the solution!*
```
eval"s//*/;say;"x<>
```
Needs free `-E` (or `-M5.010`) flag to run. Takes a number from input :
```
perl -E 'eval"s//*/;say;"x<>' <<< "5"
```
[Answer]
# J, ~~11~~ 8 bytes
*Saved 3 bytes thanks to miles!*
```
]\@#&'*'
```
Here is a decomposition:
```
(]\@#&'*') x
x (]\@#) '*'
]\ (x # '*')
```
Now, this last one reads as "the prefixes (`]\`) of the string consisting of `x` copies of `'*'`". Observe:
```
   5 ]\@# '*'
*
**
***
****
*****
   ]\ 5# '*'
*
**
***
****
*****
   ]\ 5 # '*'
*
**
***
****
*****
   ]\@#&'*' 5
*
**
***
****
*****
```
## Test case
```
   f =: ]\@#&'*'
   f 3
*
**
***
   f 5
*
**
***
****
*****
   f 1
*
   f 2
*
**
   f &. > ;/1+i.10
+-+--+---+----+-----+------+-------+--------+---------+----------+
|*|* |*  |*   |*    |*     |*      |*       |*        |*         |
| |**|** |**  |**   |**    |**     |**      |**       |**        |
| |  |***|*** |***  |***   |***    |***     |***      |***       |
| |  |   |****|**** |****  |****   |****    |****     |****      |
| |  |   |    |*****|***** |*****  |*****   |*****    |*****     |
| |  |   |    |     |******|****** |******  |******   |******    |
| |  |   |    |     |      |*******|******* |*******  |*******   |
| |  |   |    |     |      |       |********|******** |********  |
| |  |   |    |     |      |       |        |*********|********* |
| |  |   |    |     |      |       |        |         |**********|
+-+--+---+----+-----+------+-------+--------+---------+----------+
```
## Older, 11-byte solutions
```
'*'#~"+1+i.
```
This is equivalent
```
'*' #~"0 1 + i.
```
`1 + i.` is the range `[1, x]`. Then, `'*' #~"0` applied to this range shapes (element) copies of `'*'`.
Bonus program:
```
[:#&'*'\#&1
```
This is a capped fork `#&'*'\` applied to the result of `#&1` of the input. `#&1` gives an array of `x` ones, and `#&'*'\` shapes `'*'` to the prefixes of this array.
### Test cases
```
   f1 =: '*'#~"+1+i.
   f2 =: [:#&'*'\#&1
   f1 1
*
   f2 2
*
**
   f1 3
*
**
***
   f2 4
*
**
***
****
   f2 5
*
**
***
****
*****
   f1 5
*
**
***
****
*****
   (f1;f2)3
+---+---+
|*  |*  |
|** |** |
|***|***|
+---+---+
   f1;f2
f1 ; f2
   (f1;f2)5
+-----+-----+
|*    |*    |
|**   |**   |
|***  |***  |
|**** |**** |
|*****|*****|
+-----+-----+
   (f1;f2)10
+----------+----------+
|*         |*         |
|**        |**        |
|***       |***       |
|****      |****      |
|*****     |*****     |
|******    |******    |
|*******   |*******   |
|********  |********  |
|********* |********* |
|**********|**********|
+----------+----------+
```
[Answer]
# Vim, ~~22~~, 18 keystrokes
```
O <esc>J:h r<cr>lyEZZ<C-v>{@"
```
Huge credit to [@Udioica](https://codegolf.stackexchange.com/a/95900/31716) for coming up with an awesome vim answer that I expanded on. This answer does not contain any asterisks, in hopes of winning the bounty.
Explanation:
Input is typed before the rest of the program. Udioica came up with this awesome trick. Typing `<n>O <esc>` will create a pyramid of spaces and one empty line, as long as you have `:set autoindent` enabled. This option comes on by default in vim 8 and neovim, though not older versions of vim. Since this also creates an extra line, we use `J` to join this line with the next one, which effectively just removes the line below us.
Now at this point, we need to replace all of these spaces with asterisks. If I was not worried about using asterisks in my code, I would just visually select the whole thing `<C-v>{` and type `r*`, which replaces each character of the selection with an asterisk. But I can't do that.
So we open up the help pages to `:h r`. The interesting thing about this is that in the vim-window, this page is displayed as:
```
                            r
r{char}         Replace the character under the cursor with {char}.
                ...
```
With the cursor on the first 'r'. However, the file itself actually contains this text:
```
                            *r*
r{char}         Replace the character under the cursor with {char}.
                ...
```
Pretty convenient. So we move over one character with `l`, and yank the text `r*` with `yE` ([y]ank to the [E]nd of this word).
To close this buffer, we use the shortcut to save a file `ZZ`. Now, we visually select our spaces, and run the yanked text as if we had typed it by doing `@"`. This works because "@" runs the following register as vim-keystrokes, and " is the default register for yanking.
[Answer]
# C, ~~47~~ ~~46~~ ~~45~~ 43 bytes
Takes input from the command line
```
f(n){for(n&&f(n-1);~n;putchar(n--?42:10));}
```
Basically if n is not 0 recurse on n-1. at the top of the recursion where n is 0 it just prints a newline, the for loop terminates when n is -1 or ~n is zero, otherwise it prints ASCII 42 which is '\*'.
Try it on [ideone](http://ideone.com/CArPHN)
# C++ 58 Bytes + 19 for including iostream is 77
```
#include<iostream>
int f(int n){for(n&&f(n-1);~n;std::cout<<(n--?"*":"\n"));}
```
```
main(c,v)char**v;
{
    f(atoi(v[1]));
}
```
```
a.exe 3
*
**
***
```
[Answer]
# Commodore 64/VIC-20 BASIC (and compatible C= 8-bits), ~77 tokenized BASIC bytes
```
0 INPUT"NUMBER OF *";A:ON-(A<1)GOTO1:J=1:FORI=1TOA:FORX=1TOJ:PRINT"*";:NEXTX:J=J+1:PRINT:NEXTI
1 :
```
Technically line 1 isn't required, but I'm mis-using the `ON...GOTO` command as a conditional `GOTO` in line zero so I added in the shortest possible line 1 to end it gracefully.
You will need to use Commodore keyword abbreviations to fit line zero on a C64, see the screen shot below (Note that the C128 in 128 mode might have different keyword abbreviations, but then you can enter more characters so you probably won't need it):
[![Commodore 64 asterisk printing simulator](https://i.stack.imgur.com/DYdSj.png)](https://i.stack.imgur.com/DYdSj.png)
[Answer]
## [Retina](http://github.com/mbuettner/retina), 14 bytes
Byte count assumes ISO 8859-1 encoding.
```
.+
$**
.
$`$&¶
```
[Try it online!](http://retina.tryitonline.net/#code=LisKJCoqCi4KJGAkJsK2&input=NQ)
### Explanation
```
.+
$**
```
Turn the input `N` into `N` asterisks.
```
.
$`$&¶
```
Replace each asterisk with everything up to and including that asterisk (this is the `$`$&`) and a linefeed (this the `¶`).
[Answer]
# MATL, ~~9~~ 8 bytes
*1 byte saved thanks to @Luis*
```
:"42@Y"c
```
[**Try it Online**](http://matl.tryitonline.net/#code=OiI0MkBZImM&input=NQ)
]