g | x | w | all
Bytes Lang Time Link
011Vyxal 3250825T123203ZThemooni
060AWK250822T184101Zxrs
052YASEPL240213T193241Zmadeforl
020Perl 5 + p240215T131018ZDom Hast
133Go240214T143253Zbigyihsu
059JavaScript Node.js240214T121626Znoodle p
008Vyxal240213T234537Zemanresu
019J240213T233416ZJonah
087TypeScript's type system240213T203129Znoodle p
nanVyxal j240213T132843Zpacman25
012MATL190610T111229ZSuever
046Zsh210422T200947Zpxeger
072Forth gforth201110T090825ZRazetime
023Husk201005T074023ZRazetime
085Rockstar200911T143033ZShaggy
069MAWP200816T063002ZRazetime
086Python 3200325T183008ZDion
069Erlang escript200325T074249Zuser9206
059Perl 5191014T155955ZrpGYNay0
055Python 3191014T035349ZMatthew
074\/\/>190705T051141Ztorcado
nanPHP190617T184051Z640KB
091Pepe190616T141123Zu-ndefin
133Rockstar190615T170504Zgaborsch
091Swift 5/Xcode 10.2.1190610T111154ZRoman Po
056Ruby190609T225445ZSixtyfiv
125brainfuck190613T194859ZHelena
080Python 3.8 prerelease190613T150544Zsquid
083Python 3190612T145940ZMiriam
677MarioLANG190610T103036ZCharlie
018Pyth190612T113516ZSok
1179 Batch File190611T231319ZBDM
056C gcc190609T102538Zatt
019Pyth190612T021332ZDoggyDog
023Pyth190611T202226Ztrillian
015Japt R190611T154116ZShaggy
080Java 8190611T144925ZKevin Cr
049Haskell190609T181844ZJoseph S
052C64Mini/C64 BASIC and other CBM BASIC variants190610T112253ZShaun Be
115Twig190610T064636ZIsmael M
042JavaScript Node.js190610T013428ZShieru A
100SimpleTemplate190610T061647ZIsmael M
041PowerShell190610T051846Zmazzy
050PowerShell190610T021913ZVeskah
010Stax190609T232117Zrecursiv
075Python 2190609T192759Zruohola
065C gcc190609T061317Zgastropn
080TSQL code190609T123854Zt-clause
032Retina 0.8.2190609T100824ZNeil
00605AB1E190609T095506ZEmigna
080APLNARS190609T092635Zuser5898
005Charcoal190609T085851ZNeil
002Canvas190609T073343Zdzaima
054Python 2190609T062136Zxnor
063Python 2190609T060924ZChas Bro
036Perl 5 p190609T060108ZXcali
066C# Visual C# Interactive Compiler190609T045042ZGymhgy

Vyxal 3, 11 bytes

ƛᏜ\/f«⍟U⇄J”

Vyxal It Online!

ƛᏜ\/f«⍟U⇄J”­⁡​‎‎⁡⁠⁡‏⁠‎⁡⁠⁢⁣‏‏​⁡⁠⁡‌⁢​‎⁠⁠⁠‎⁡⁠⁢⁢‏‏​⁡⁠⁡‌⁣​‎‎⁡⁠⁢‏⁠‎⁡⁠⁣‏⁠‎⁡⁠⁤‏⁠‎⁡⁠⁢⁡‏‏​⁡⁠⁡‌⁤​‎‎⁡⁠⁢⁤‏‏​⁡⁠⁡‌⁢⁡​‎‎⁡⁠⁣⁡‏‏​⁡⁠⁡‌⁢⁢​‎‎⁡⁠⁣⁢‏⁠‎⁡⁠⁣⁣‏‏​⁡⁠⁡‌­
ƛ     ⍟      # ‎⁡map over implicit range implicit input, then flatten
     «       # ‎⁢pad left with n spaces...
 Ꮬ\/f        # ‎⁣each in the array ['\','/']
       U     # ‎⁤uninterleave, extracting the tail
        ⇄    # ‎⁢⁡reverse that
         J”  # ‎⁢⁢join it at the end, and join by newlines
💎

Created with the help of Luminespire.

<script type="vyxal3">
ƛᏜ\/f«⍟U⇄J”
</script>
<script>
    args=[["2"],["5"]]
</script>
<script src="https://themoonisacheese.github.io/snippeterpreter/snippet.js" type="module"/>

AWK, 60 bytes

a=x="\\\n"{for(b=y="/\n";++i<$1;y=z b y)x=x (z=z" ")a}$0=x y

Attempt This Online!

YASEPL, 58 52 bytes

=i=a'`1=b;" ",i~>"\"!+}7,a`2-=b;" ",i~>divide!}7,0,2

explanation:

=i=a'`1=b;" ",i~>"\"!+}7,a`2-=b;" ",i~>divide!}7,0,2           packed
=i                                                             I = increment variable
  =a'                                                          get user input (arrow size)
     `1             ! }7,a                                     while I != A ...
       =b;" ",i~>"\"                                             write I amount of spaces and a backslash
                     +                                           increment I and loop
                          `2                 !}7,0,2           while I != 0...
                            -                                    subtract 1 from I
                             =b;" ",i~>divide                    write I amount of spaces and a slash

and just for fun...

ibe, 118 bytes

adadadadadadaddsRafWmreafYmpeafUmtiakqskTagTmwakwafTmwslWssTmQmwaaYafQmwssQmRmqakeskTakrafTmwslWssTmQmraaUagQmwsaQmqme

(this is an esolang i made a while ago that i dont plan on releasing)

Perl 5 + -p, 20 bytes

Uses non-printable characters (backspace 0x08 and form feed 0x0c) to position the characters in the terminal.

$_='\.'x$_."./.."x$_

Try it online!

Explanation

Stores in $_ a repetition of the literal string \<FF> $_ (implicit input) times, concatenated with <BS>/<FF><BS> repeated $_ times.

$_ is then output implicitly by -p.

Go, 133 bytes

import."strings"
func f(n int)(o string){for i:=0;i<n;i++{o+=Repeat(` `,i)+"\\\n"}
for i:=n;i>0;i--{o+=Repeat(` `,i-1)+"/\n"}
return}

Attempt This Online!

Go 1.22+, 131 bytes

import."strings"
func f(n int)(o string){for i:=range n{o+=Repeat(` `,i)+"\\\n"}
for i:=range n{o+=Repeat(` `,n-i-1)+"/\n"}
return}

You cannot Attempt This Online!

Run it on the Go Playground!

JavaScript (Node.js), 59 bytes

n=>eval("for(o='';s=''.padEnd(n--);)o=s+`\\\\\n${o+s}/\n`")

Attempt This Online!

I had a different idea, it didn't turn out as golfy as the obvious method but I still felt like posting it.

The program constructs the string with a for loop, counting down from n, and continuously sets a string o to: n spaces, backtick, newline, o, n spaces, forward slash, newline.

Vyxal, 8 bytes

ɾ\\↳↲øṀ§

Try it Online!

   ↳     # Right-pad
 \\      # \
ɾ        # To length each of range(1, n+1)
    ↲    # Left-pad each to length n
     øṀ  # Mirror, flipping slashes
       § # Vertical join, transposing and joining by newlines

J, 19 bytes

' \/'{~(,2*|.)@=@i.

Try it online!

TypeScript's type system, 87 bytes

//@ts-nocheck
type F<N,S="">=N extends[{},...infer N]?`
${S}\\${F<N,`${S} `>}
${S}/`:""

Try it at the TypeScript playground

Takes input as a unary number represented by a tuple type N. If I instead took the unary number as a string type of spaces, this becomes 71 bytes:

type F<S,O=''>=S extends` ${infer S}`?F<S,`${S}\\
${O&string}${S}/
`>:O

Try it at the TS playground

I like the shorter version better because it's tail-recursive and just overall really elegant, but I think the I/O format is a little cheaty.

Vyxal j, 95 bitsv2, 11.875 bytes

ƛI\\JøṀ;½fyRṘJ

Try it Online!

Bitstring:

00001000000011101111110001100110011110111010010010110001001000111000011010000100001110000011111

Beats all non-canvas users

MATL, 14 13 12 bytes

Xy92*t45-Pvc

1 Byte saved thanks to @LuisMendo

Explanation

        % Implicitly grab the input as an integer
Xy      % Create an identity matrix this size
92*     % Multiply by 92 (ASCII for '\')
t       % Duplicate the matrix
45-     % Subtract 45 from every element yielding 47 (ASCII for '/') on the diagonal
        % and -45 everywhere else
P       % Vertically flip this matrix
v       % Vertically concatenate the two matrices
c       % Convert to characters (negative numbers are replaced with a space)
        % Implicitly display the result

Try it out at MATL Online

Zsh, 46 bytes

/ \\()for a;<<<${(l:a:)0};\\ {1..$1};/ {$1..1}

Try it online!

It really ought to be possible to get shorter than this...

Forth (gforth), 72 bytes

: f dup 0 ?do i spaces 92 emit cr loop 1- for i spaces 47 emit cr next ;

Try it online!

there's probably a better way to do this.

Husk, 23 bytes

+mo`:'\R' ŀ¹mo`:'/R' ↔ŀ

Try it online!

There is probably a way to halve the size of this program.

Rockstar, 85 bytes

listen to N
X's0
while N-X
say " "*X+"\"
let X be+1

while X
let X be-1
say " "*X+"/"

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

MAWP, 69 bytes

%@!0//[!1A]%[1A[1A84W;]%99W25WM1M;25W;]%[!1A]~[1A[1A84W;]%67W5M;25W;]

I am not going to golf this further bcause funny number. Sorry, guys.

Try it!

Python 3, 91 86 bytes

n=range(int(input()))
for i in n:print(' '*i+'\\')
for i in n:print(' '*(n[-1]-i)+'/')

Try it online!

Edit 1: saved 5 bytes by making n a range instead of integer

Erlang (escript), 69 bytes

Port of xnor's Python answer.

r(0,_)->"";r(I,X)->X++"\\\n"++r(I-1,X++" ")++X++"/\n".
r(I)->r(I,"").

Try it online!

Perl 5, 59 bytes

$_--;say$"x$_."\\"for(0..$_);say$"x$_."/"for(reverse 0..$_)

Example execution:

perl -nE '$_--;say$"x$_."\\"for(0..$_);say$"x$_."/"for(reverse 0..$_)'

Waits for an integer to be provided on STDIN when executed. Once provided, it will display the arrow.

Python 3, 55 bytes

f=lambda n,i="":n and i+"\\\n"+f(n-1,i+" ")+i+"/\n"or""

Try it online!

\/\/>, 74 bytes

jp100o
-84*}!o:?!x1
@+:q:p=?x:o~$:0(pa"\/"q?$~}}:
x2-:p$1-y$:0(?
.{suh?!;2

Explanation: (lines rotated based on start point)

jp100o                        //setup
:?!x1-84*}!                   //add leading spaces, loop and decrement until 0
~$:0(pa"\/"q?$~}}:@+:q:p=?x:o //add correct slash, go back to loop or switch sides
$:0(?x2-:p$1-y                //flip direction state or continue to print
{suh?!;2.                     //remove extra data and print stack

PHP, 79 63 61 bytes

function f($x,$s=''){if($x)echo"$s\\
",f($x-1,"$s "),"$s/
";}

Try it online!

Recursive in PHP.

-12 bytes by @manatwork

Pepe, 91 bytes

rErEeEeEEEeeREeEREErereeereeERrEeeEeeeeeRrEeeeReereRerEEEererEeeEeEEEErEEEEREErereeereeERee

Try it online!

Rockstar, 133 bytes

Try it online here!

F takes N,S
If N is 0
Give back N

Say S+"\"
Let T be S+" "
Let M be N-1
F taking M,T
Say S+"/"

Listen to X
F taking X,""

Since Rockstar is not famous for string operations, it takes relatively lots of code to do it (recursively was even longer).

The size of the arrow is taken as input.

Swift 5/Xcode 10.2.1, 91 bytes

(0..<n*2).map{String(repeating:" ",count:$0<n ?$0:n*2-$0-1)+($0<n ?"\\":"/")+"\n"}.joined()   

Try it online!

Ruby, 111 99 77 73 68 64 57 56 bytes

-12 bytes thanks to Benjamin Urquhart, -43 thanks to manatwork and -2 bytes thanks to Value Ink.

->i{s=[];puts (0...i).map{|j|s=(p=' '*j)+?/,*s;p+?\\},s}

Try it online!

Explanation:

f=->i{                      # instead of a function, use a lambda
  s=[]                      # needs a helper variable *now*, for scope
  puts(                     # puts takes arbitrary num of args; \n after each
    (0...i).map{|j|         # not from 0 to i but from 0 to i-1 (*three* dots)
      s=(
        p=' '*j             # p will remain in scope inside of .map,
      )
      +?/                   # character literal instead of string
      ,*s                   # essentially appending to the array
      
      p+?\\                 # p is what's returned by .map, not s!
      
    },                      # up until here, 1st arg to display
    s                       # NOW, as the *2nd* arg, s is displayed
  )
}

Alternative (but longer) Solutions

A friend read this answer and then tried to come up with a couple more approaches. Putting them here, too, so that they're not lost to the vast interwebs.

inject and unshift, 72 bytes

->n{puts (0...n).inject([]){|s,i|i=' '*(n-1-i);s.unshift i+?\\;s<<i+?/}}

Try it online!

downto, inject and unshift, 80 bytes

->n{puts n.downto(1).map{|i|' '*(i-1)}.inject([]){|s,i|s<<i+?/;s.unshift i+?\\}}

Try it online!

intriguing, two non-nested loops, 127 bytes

->n{
r=->s,c{s[0..-(c+1)],s[-c..-1]=s[c..-1],s[0..c-1];s};
n.times{|i|puts r[' '*n+?\\,n-i]}
n.times{|i|puts r[' '*n+?/,i+1]}
}

Try it online!

brainfuck, 125 bytes

++++++++++[->+>+++++++++>+++<<<]>>++>++>,[->[->+<<<.>>]<<<.<.>>>>>[-<+>]<+<]<<[--<<+>>]<<+>>>>>[-[-<+<.>>]<<<<<.>.>>>[->+<]>]

Try it online!

++++++++++[->+>+++++++++>+++<<<]>>++>++>    ; Initialize with " \"
,                                           ; Get input
[->                                         ; loop and decrement n 
    [->+<<<.>>]                             ; output number of spaces, copy n
    <<<.                                    ; output \
    <.                                      ; output newline
    >>>>                                    
    >[-<+>]<+                               ; copy copy of n back to original place 
<]
<<[--<<+>>]<<+>>                            ; change "\" to "/"
>>>                             
[                                           ; second loop for bottom half
 -                                          ; decrement n
 [-<+<.>>]                                  ; output n spaces
 <<<<<.>.                                   ; output \ and newline
 >>>[->+<]>                                 ; copy n back
]

Python 3.8 (pre-release), 80 bytes

lambda n:'\n'.join([' '*i+'\\'for i in(r:=range(n))]+[' '*(n+~i)+'/'for i in r])

Try it online!

Same approach as the one I suggested to @Artemis Fowl, but takes advantage of the walrus operator.

Python 3, 90 83 bytes

lambda n:'\n'.join([' '*i+'\\'for i in range(n)]+[' '*(n+~i)+'/'for i in range(n)])

Try it online!

-7 bytes thanks to @squid

MarioLANG, 719 677 bytes

+
+
+
+
+
+         ((((+)+++++)))<
+>======================"
+)++++++)+++++++++++((-[!)
========================#=-
) ![-    <+;)+++)---)++++)<
)=#======"=================
) >)+)+((!
+ "======#
         <))))).(((((((<
 ========">============"
>)+)+((-[!+))        -[!((((((((.)).))))+(-[!)
"========#=============#====================#<
!)                                          <
#==========================================="
                  >(((((.)))>
                  "========<"========
 ![-)).))).(((((((![-    ))+![-((+)+)<((![<
 #================#=========#========"==#="===
 >                                   !  >-!
 "===================================#  "=#

Try it online!

This was harder than expected...

Pyth, 18 bytes

js.e+R?k\/\\b_B*L;

Try it online!

Batch File, 117 + 9 bytes

Executed using cmd/v/q/c.

for /l %%i in (1,1,%1)do (for /l %%j in (2,1,%%i)do set %%i= !%%i!)&echo !%%i!\
for /l %%i in (%1,-1,1)do echo !%%i!/

C (gcc), 56 bytes

f(n,i){for(i=-n;n;printf("%*c\n",i?++i+n:n--,i?92:47));}

Try it online!

f(n,i){for(i=-n;i;printf("%*c\n",  ++i+n    ,  92   ));     //first print descending '\'s
       for(    ;n;printf("%*c\n",        n--,     47));}    // then print returning  '/'s

Pyth, 19 bytes

VQ+*dN\\)V_Q+*dhN\/

Try it online!

TIL multiplying a string by a negative value multiplies it by its absolute value.

Pyth, 23 bytes

V2VQ
+*?N--QH1H\ ?N\/\\

Try it online!

Note that the program must not have a terminating newline! If saving it on linux, you can remove the last byte in a file using head -c -1 <file>.

I think this is the first time I have used for loops in pyth? Anyways, this is a rather direct port of the example source code in the question (though the 2 loops are combined, and the innermost loop is converted into string multiplication, and the remaining 2 prints are joined into one).

Japt -R, 15 bytes

"\\/"¬c@õ!ùX zY

Try it

õ!ù'\ cUÆ'/ ùU´

Try it

Java 8, 80 bytes

n->{for(int i=0;i<2*n;)System.out.printf("%"+(i++<n?i:n-~n-i)+"c\n",i>n?47:92);}

Try it online.

Explanation:

n->{                    // Method with integer parameter and no return-type
  for(int i=0;i<2*n;)   //  Loop `i` in the range [0, 2 * input `n`):
    System.out.printf(  //   Print with format:
      "%"+(i++<n?       //    If `i` is smaller than input `n`:
                        //    (and increase `i` by 1 right after this check with `i++`)
            i           //     Use `i` leading spaces
           :            //    Else:
            n-~n-i)     //     Use `2 * n - i + 1` leading spaces
      +"c\n",i>n?       //    If `i` is larger than input `n`:
              47        //     Append a trailing '/' and newline
             :          //    Else:
              92);}     //     Append a trailing '\' and newline

Haskell, 52 49 bytes

-3 bytes thanks to Sriotchilism O'Zaic.

unlines.g
g 0=[]
g n="\\":map(' ':)(g$n-1)++["/"]

Try it online!

C64Mini/C64 BASIC (and other CBM BASIC variants), 52 tokenized BASIC bytes used

 0INPUTN:N=N-1:FORI=0TON:PRINTTAB(I)"\":NEXT:FORI=NTO0STEP-1:PRINTTAB(I)"/":NEXT

Here is the non-obfuscated version for exaplantion:

 0 INPUT N
 1 LET N=N-1
 2 FOR I=0 TO N
 3  PRINT TAB(I);"\"
 4 NEXT I
 5 FOR I=N TO 0 STEP -1
 6  PRINT TAB(I);"/"
 7 NEXT I

What ever number is entered into N in line zero is reduced by one as the TAB command is zero-indexed; The FOR/NEXT loops in lines two through to four and five through to seven then output the upper and lower part if the meme arrow respectively (represented by a shifted M and shifted N in graphics mode source)

Commodore C64 meme arrow

Twig, 115 bytes

Builds the string backwards, "returning" it in the end.

Uses a macro to generate all the results.

{%macro a(N,s="")%}{%for i in N..1%}{%set s=('%'~i~'s
'~s~'%'~i~'s
')|format('\\','/')%}{%endfor%}{{s}}{%endmacro%}

This macro has to be in a file, and imported like this:

{% import 'macro.twig' as a %}

{{ a.a(<value>) }}

You can try it on https://twigfiddle.com/5hzlpz (click on "Show raw result").

JavaScript (Node.js), 42 bytes (If trailing new line is allowed)

n=>(F=s=>n--?s+`\\
`+F(s+" ")+s+`/
`:"")``

Try it online!

JavaScript (Node.js), 48 46 bytes

n=>(F=s=>s+`\\
${--n?F(s+" ")+`
`:""}${s}/`)``

Try it online!

SimpleTemplate, 100 bytes

This was quite a fun challenge, but some bugs in the language made it hard to optimize.

{@set_ argv.0}{@while_}{@callstr_repeat intoS" ",_}{@setO S,"\\\n",O,S,"/\n"}{@incby-1_}{@/}{@echoO}

Basically, cycles throught the values backwards, working the string from the middle out.


How the answer should be

Due to the bugs, the code wasn't being interpreted properly.

This is how the code would be, if the compiler didn't had any bug (86 bytes):

{@forfrom argv.0to0step-1}{@callrepeat intoS" ",_}{@setO S,"\\
",O,S,"/
"}{@/}{@echoO}

Oh, well, at least the solution works :x

PowerShell, 44 41 bytes

filter f{if($_){'\'
--$_|f|%{" $_"}
'/'}}

Try it online!

PowerShell, 50 bytes

param($n)0..--$n|%{' '*$_+'\'}
$n..0|%{' '*$_+'/'}

Try it online!

Will look into making it so it only goes through the range once. Not bad for the no brain method though.

Stax, 10 bytes

Ç₧¥╗M'gQ9⌂

Run and debug it

Python 2, 85 84 81 80 75 bytes

def a(n):l="for i in range(n):print' '*";exec l+"i+'\\\\'\n"+l+"(n+~i)+'/'"

Try it online!

C (gcc), 67 65 bytes

-2 bytes thanks to ceilingcat

f(n,i){for(i=~n;i++<n;)i&&printf("%*c\n",n-abs(i)+1,"/\\"[i<0]);}

Try it online!

T-SQL code, 80 bytes

DECLARE @ INT=3

,@z INT=0
x:PRINT
space(@-abs(@-@z-.5))+char(92-@z/@*45)SET
@z+=1IF @z<@*2GOTO x

Try it online

T-SQL query, 96 bytes

In order to make this work online i had to make some minor alterations. Spaces in the beginning of a row doesn't display in the online snippet. So I am using ascii 160 instead. When running in management studio, it is possible to change the settings to show result as text, which would result in the correct spaces in this posted script.

DECLARE @ INT=3
SELECT space(@-abs(@-number-.5))+char(92-number/@*45)FROM
spt_values WHERE number<@*2and'p'=type

Try it online

Retina 0.8.2, 32 bytes

.+
$* ¶$&$* 
\G.
¶$`\
r`.\G
$'/¶

Try it online! Explanation:

.+
$* ¶$&$* 

Generate two lines of n spaces.

\G.
¶$`\

Turn the top line into a \ diagonal.

r`.\G
$'/¶

Turn the bottom line into a / diagonal.

05AB1E, 6 bytes

'\3.Λ∊

Try it online!

Explanation

   .Λ    # draw
'\       # the string "\"
         # of length input
  3      # in the south-eastern direction
     ∊   # then vertically mirror it

APL(NARS), 40 chars, 80 bytes

{f←{⍺,⍨⍵⍴' '}⋄⊃('\'f¨k),('/'f¨⌽k←¯1+⍳⍵)}

test:

  h←{f←{⍺,⍨⍵⍴' '}⋄⊃('\'f¨k),('/'f¨⌽k←¯1+⍳⍵)}
  h 2
\ 
 \
 /
/ 
  h 5
\    
 \   
  \  
   \ 
    \
    /
   / 
  /  
 /   
/    

Charcoal, 5 bytes

↘N‖M↓

Try it online! Link is to verbose version of code. Explanation:

↘N

Input a number and print a diagonal line of \s of that length.

‖M↓

Reflect the line vertically.

Canvas, 2 bytes

\═

Try it here!

Python 2, 54 bytes

f=lambda n,p='':n*'?'and p+'\\\n'+f(n-1,p+' ')+p+'/\n'

Try it online!

Outputs with a trailing newline.

Python 2, 63 bytes

f=lambda n,s='':n and f(n-1,~-n*' '+'\\\n'+s+~-n*' '+'/\n')or s

Try it online!

Perl 5 -p, 36 bytes

$\=($q=$"x$_)."\\
$\$q/
"while$_--}{

Try it online!

C# (Visual C# Interactive Compiler), 66 bytes

n=>new int[n*2].Select((a,b)=>"".PadLeft(b<n?b:n*2+~b)+"\\/"[b/n])

Saved a byte thanks to @someone.

Try it online!