g | x | w | all
Bytes Lang Time Link
056Excel201016T183403ZEngineer
038Raku Perl 6 rakudo251002T132111Zxrs
052AWK251001T173345Zxrs
031Ly220604T091809Zcnamejj
055Python 3220604T083827ZSapherey
018Vyxal j220602T204400ZnaffetS
059JavaScript220602T223149ZMatthew
056Factor220602T214113Zchunes
028Pyth220307T162717Zsinvec
123Batch210501T055941ZT3RR0R
111Whispers v2210207T162145ZRazetime
092Whispers v2210209T032014ZLeo
089Forth gforth201108T124043ZRazetime
053Bash201108T134759ZF. Hauri
012Canvas201104T034604ZRazetime
097><>201016T215053Ztjjfvi
045Rust200803T175806ZTehPers
031Integral200803T154556Znph
015Cinnamon Gum201015T003810ZSisyphus
025CJam201014T082709ZDion
095MAWP 1.1200803T164829ZDion
041MAWP 2.0200908T071210ZDion
032MATLAB/Octave200805T091945ZTom Carp
118Pepe200810T014247Zu-ndefin
1741+200808T112313ZTwilight
420COW200808T144345ZDingus
041Python 3200806T032703ZKyuuhach
061Java 11200805T075838ZKevin Cr
032Perl 5 p200804T190259ZDom Hast
074R200806T145132ZGiuseppe
097C#200806T140155ZRegin La
050Python 3200806T073413ZBrian H.
174brainfuck200805T143111Zjonatjan
092MAWP v1.1200806T064129ZRazetime
017V vim200806T044520Znmjcman1
041PowerShell200804T154407ZVeskah
017Husk200805T110302ZZgarb
243Whitespace200805T090759ZKevin Cr
011Charcoal200803T184813ZNeil
022Retina200805T083246ZKevin Cr
060PHP200804T104708ZKaddath
070C gcc200804T025559Zgastropn
02105AB1E200803T190752ZSomoKRoc
040Perl 5 p200804T134846ZXcali
01705AB1E200804T092545ZKevin Cr
091C gcc200803T184231ZNoodle9
058Haskell200804T091423Zovs
020Japt200803T195004ZShaggy
024Pyth200804T074837ZMukundan
127Io200804T051414Zuser9649
512i386 16bit mode Bootsector200804T032629Zsugarfi
049Perl 6200804T024121Zsugarfi
075C gcc200803T194501Zatt
047Scala200803T221639Zuser
047Python 2200803T205909Zxnor
050JavaScript ES8200803T160225ZArnauld
019Jelly200803T170431ZJonathan
057Python 3200803T165446Zhyperneu
020MATL200803T163036ZLuis Men
057Ruby200803T160848ZRazetime
036Ruby200803T160133ZDingus
021APL Dyalog Unicode200803T155848ZAdá

Excel, 58 56 bytes

Storing the repeated spaces as a variable using LET() saves 2 more bytes than it costs to implement.

=LET(s,REPT(" ",A1)," "&REPT("_",A1)&"
/"&s&"\
|"&s&"|")

Straightforward implementation. The line breaks are inside strings to they'll print.

Once the input is large enough, it is difficult to display the entire thing.

Screenshot1

Screenshot1000

Raku (Perl 6) (rakudo), 38 bytes

{" {'_'x$_}\n/{' 'x$_}\\\n|{' 'x$_}|"}

Attempt This Online!

Doesn't work on ATO, but I'll leave the link for, uh... posterity.

AWK, 52 bytes

{for(s=FS;i++<$1;t=t" ")s=s"_"}$0=s"\n/"t"\\\n|"t"|"

Attempt This Online!

Ly, 42 31 bytes

"| |\ / - "nsp[ol[f:of,]ppo9`o]

Try it online!

This version is shorter using a completely different algorithm. It pushes 3 characters that define what each output line should look like. The leading char, the repeated char, and the closing char. After pushing those triplets to the stack, the code loops until the stack is empty. Each time through the loop prints one line, with an inner loop to generate the repeating characters.

"| |\ \ - "                     - Push 3-char loop instructions
           nsp                  - Read the number, store and delete
              [               ] - Loop once per output line
               o                - print the leading char
                l[     ]p       - load the number, loop that many times
                  f             - pull the char to print forward
                   :o           - duplicate and print
                     f          - pull the iterator number forward
                      ,         - decrement
                         p      - delete the char
                          o     - print closing char
                           9`o  - push a LF and print it

Python 3, 58 55 bytes

lambda n:f" {'_'*n if n else''}\n/{' '*n}\\\n|{' '*n}|"

Try it online!

Simple f-string

Vyxal j, 18 bytes

\_2꘍f*` /|`vøṀ$¨vj

Try it online or verify all test cases.

How?

\_2꘍f*` /|`vøṀ$¨vj
\_                 # Push "_"
  2꘍               # Append two spaces, making this "_  "
    f              # Convert to list of characters
     *             # Repeat each the input amount of times
      ` /|`        # Push string " /|"
          vøṀ      # For each (implicitly converting to a list), mirror it, flipping "/" to "\"
             $     # Swap
              ¨vj  # Join each in the other list by the corresponding value in the top list
                   # j flag joins on newlines

JavaScript, 59 bytes

f=n=>n?f(n-1).replace(/.\n/g,c=>' _'[c<1|0]+c):`  
/\\
||
`

Try it online!

A recursive function. Uses how JS coerces whitespace to 0, and punctuation to NaN.

Not as competitive as Arnauld's JS answers, but I think it's still interesting.

Factor, + sequences.repeating 56 bytes

[ "_"over cycle " "rot cycle dup [I  ${}
/${}\
|${}|I] ]

Attempt This Online!

       ! 5
"_"    ! 5 "_"
over   ! 5 "_" 5
cycle  ! 5 "_____"
" "    ! 5 "_____" " "
rot    ! "_____" " " 5
cycle  ! "_____" "     "
dup    ! "_____" "     " "     "

And the rest just interpolates the strings on the data stack into the ${} and prints it out.

Pyth, 28 bytes

%" %s\n/%s\\\n|%s|"m*dQ(\_dd

Port of @xnor's Python 2 solution.

Try it online!

Batch 154 151 143 133 123 bytes

Notes:

@Set o=@^<nul set/P 
@Set "f=&@(for /l %%p in (1 1 %1)do %o%"
%o%=ESCB %f%=_)&%o%=ESC[1E/%f%=ESC[s )&%o%=\ESC[1E^|%f%=ESC7 )&%o%=^|

How:

Whispers v2, 148 135 111 bytes

> Input
> "_"
> " "
> "/"
> "|"
> "\\"
>> 1⋅2
>> 3+7
>> 3⋅1
>> 4+9
>> 10+6
>> 5+9
>> 12+5
>> Output 8 11 13

Try it online!

This took much longer than expected to make.

-13 bytes from Michael Chatiskatzi.

-24 bytes from Leo.

Whispers v2, 92 bytes

> 1
> Input
> " _\n/ \\\n| |"
>> Then 1 2 1 1 2 1 1 1 2 1
>> L⋅R
>> Each 5 4 3
>> Output 6

Try it online!

Sort of a run-length encoding.

Line 3 encodes the input without sequences of repeated characters. Line 4 builds the list of counts (1 is 1, 2 is the input). Line 6 combines them together repeating each character as many times as needed.

Forth (gforth), 97 89 bytes

: e emit ; : b space dup 0 ?do 95 e loop cr 47 e dup spaces 92 e cr 124 e spaces 124 e ; 

Try it online!

-8 bytes from Bubbler.

Forth goes into infinite loops when given 0 for a do loop, since every loop must run atleast once. So a for loop with an if statement is used. Otherwise, this function is pretty straightforward.

Bash, 53 bytes

printf -v v %$1s;echo -e " ${v// /_} \n/$v\\\\\n|$v|"

Try it online!

Canvas, 12 bytes

½U_× ¶\¶|+↔│

Try it here!

><>, 97 bytes

<vo" "::+1
o>"_"$1-:@?!v
/\  v~ooa"/"<
!^o:>~" "$1-:@?
" "$1-:@?!vo:>~
\"|"a"\"oo o~^
     ;o"|"/

Takes input on the stack.

Could probably be golfed further.

Rust, 76 57 53 51 45 bytes

-4 bytes thanks to madlaina

|n|print!(" {:_<1$}
/{0:1$}\\
|{0:1$}|","",n)

Try it online


Old answer (76 bytes):

|n|format!(" ")+&"_".repeat(n)+"
/"+&" ".repeat(n)+"\\
|"+&" ".repeat(n)+"|"

Try it online

Just the boring answer. Borrows are needed to satisfy the type checker, unfortunately.

Integral, 37 31 Bytes

♂8♦⌡_⌡g►⌡/⌡•8g►⌡\⌡►•⌡|⌡♦8g►⌡|⌡►

First real answer in my new language!

Try it

Explanation:

(Implicit input)
♂      Triplicate top of stack
8      Push space
♦      Swap
⌡_⌡    Push underscore
g      Repeat string
►      Concatenate
⌡/⌡    Push slash
•      Stack: ...abc -> ...bca
8      Push space
g      Repeat string
►      Concatenate
⌡\⌡    Push backslash
•      Stack: ...abc -> ...bca
⌡|⌡    Push pipe
♦      Swap
8      Push space
g      Repeat string
►      Concatenate
⌡|⌡    Push pipe
►      Concatenate

Cinnamon Gum, 15 bytes

00000000: 70 05 1f 78 e5 2d 36 4e 0b 94 1d 5b d2 c7 fd

Try it online!

CJam, 25 bytes

S'_qi:A*N'/' A*:Z'\N'|Z'|

Try it online!

Explanation:

S                           Push a space
 '_                         Push an underscore
   qi:A                     Push input and assign it to the variable A
       *                    Repeat underscores A times
        N                   Push a newline
         '/                 Push a slash
           ' A*:Z           Push a space repeated A times ad assign that to variable Z
                 '\N'|      Push a backslash, newline and |
                      Z     Push variable Z
                       '|   Push a |

MAWP 1.1, 95 bytes

%@~52WWM52WWM52WWM84W;![1A99M1M5W;]%52W;68W1A;![1A84W;]%68W2W4A;52W;56W1M4W;![1A84W;]%56W1M4W;.

Try it!

Explanation:

%                  Remove initial 1 from stack
@~                 Push input as integers and reverse stack
52WWM              Add top of stack multiplied by 10 to second 
                   stack element  [5,4,3,2] ==> [5,4,23]
52WWM52WWM         Two more times [5,4,3,2] ==> [2345]

84W;               Print a space (8*4=32)

!                  Duplicate top of stack
[                  Start of loop
1A                 Subtract 1
99M1M5W;           Print an underscore ((9+9+1)*5=95)
]                  End of loop. If result from subtraction doesn't 
                   equal to 0 jump to start of loop
%                  Remove 0
52W;               Print a newline (5*2=10)

68W1A;             Print a slash (6*8-1=47)
![1A84W;]%         Do the same loop as before but printing spaces instead
68W2W4A;           Print a backslash (6*8*2-4=92)
52W;               Print a newline

56W1M4W;           Print a pipe ((5*6+1)*4=124)
![1A84W;]%         Same loop as second
56W1M4W;           Print a pipe
.

MAWP 2.0, 43 41 bytes

32;@!"_"*:10;47;!" "*:92;10;"|":" "*:"|":

Try it!

MATLAB/Octave, 36 32 bytes

@(n)[' /|';'_  '+~(1:n)';' \|']'

Try it online!

Simple anonymous function that stitches together the first column ( /|), n middle columns (_ ), and the final column ( \|), then returns the result.

Because the strings are rows rather than columns, everything is stitched together vertically, and then the result is transposed to get the desired orientation.

This works as trailing spaces are allowed, so a fully populated matrix can be formed. If trailing spaces were disallowed, the code would be 6 bytes longer by wrapping the result in trim(...).


Pepe, 118 bytes

REeEeEEEEErEeErREEeeeEReREEEEEEeRREeeEeeeeeReeereeEreeeEeEEEEREEEEeeEREEeeeEReeereeEeEEEeereeERrEeEEEEEeerreEeReeereEe

Try it online!

1+, 174 bytes

."11+""*"**;1^<#[#(?|11##11+"1+""*""*+++;1+"\"/<1+1<1+#)]11+"""**+;11+"1+""""*++*+;1^<11++#(|?)[#(|11##11+""*"**;1+"\"/<1+1<1+#)]11+"1+"*""*++;11+"""**+;11+"*""1+""*+*+";()/;

Don't ask me how this work, I don't know at all!

I didn't yet try to golf it down (although I probably can offer a 50% discount on the bytecount when I have time), and there's still a lot of repetitions. But at least I made it.

1+ 174 vs 92 MAWP v1.1. Fiasco.

COW, 420 bytes

MoOMoOMoOMoOMoOMoOMoOMMMMoOMoOMoOmoOMMMMOOMMMMOOmoOMoOmOoMOomooMMMMOomoooommoOMoOMoOMoOMoOMooMMMmoOMMMMoOMoOMoOMoOMoOMoOMoOMoOMoOMoOMoOMoOMoOMoOMoOMMMMOOmoOMoOMoOMOOmoOMoOmOoMOomoomOoMOomooMMMmoOmoOMMMmOoMMMMoOmOomOomOoMMMMOOmoOmoOmoOMoomOomOomOoMOomooMMMmOoMoomoOmoOmoOMoomOomOoMMMMOOmoOMoomOoMOomoomoOmoOmoOMOoMOoMOoMoomOomOomOomOoMoomoOMMMmoOMMMMOOmoOmoOMoOmOomOoMOomooMMMmoOmoOMMMMoomOomOomOoMOOmoOMoomOoMOomooMMMMoo

Try it online!

Pretty happy with 140 instructions (3 bytes per instruction) considering that the ASCII values of the six required characters sum to 400.

Commented

MoOMoOMoOMoOMoOMoOMoO # push 7 to 1st memory block 						blocks: [[7]], register: nil
MMM		      # copy to register 							blocks: [[7]], register: 7
MoOMoOMoO	      # add 3 to 1st block 							blocks: [[10]], register: 7
moOMMM		      # paste 7 to 2nd block							blocks: [10, [7]], register: nil
MOOMMMMOOmoOMoOmOoMOomooMMMMOomoo # set 3rd block to 28 = 7 + 6 + 5 + 4 + 3 + 2 + 1		blocks: [10, [0], 28], register: nil
oom		      # read input n (e.g. 3) into 2nd block					blocks: [10, [3], 28], register: nil
moOMoOMoOMoOMoO	      # add 4 to 3rd block							blocks: [10, 3, [32]], register: nil
Moo		      # print ASCII character 32 (space)					blocks: [10, 3, [32]], register: nil
MMMmoOMMM	      # copy and paste 32 to 4th block						blocks: [10, 3, 32, [32]], register: nil
MoOMoOMoOMoOMoOMoOMoOMoOMoOMoOMoOMoOMoOMoOMoO # add 15 to 4th block				blocks: [10, 3, 32, [47]], register: nil
MMMMOOmoOMoOMoOMOOmoOMoOmOoMOomoomOoMOomooMMM # add 2 to 6th block 47 times			blocks: [10, 3, 32, [47], 0, 94], register: nil
moOmoOMMMmOoMMM	      # copy and paste 94 to 5th block						blocks: [10, 3, 32, 47, [94], 94], register: nil
MoO		      # add 1 to 5th block							blocks: [10, 3, 32, 47, [95], 94], register: nil
mOomOomOoMMMMOOmoOmoOmoOMoomOomOomOoMOomooMMM # print ASCII character 95 (underscore) n times	blocks: [10, [3], 32, 47, 95, 94], register: nil
mOoMoo		      # print ASCII character 10 (newline)					blocks: [[10], 3, 32, 47, 95, 94], register: nil
moOmoOmoOMoo	      # print ASCII character 47 (forward slash)				blocks: [10, 3, 32, [47], 95, 94], register: nil
mOomOoMMMMOOmoOMoomOoMOomoo # print n spaces							blocks: [10, [0], 32, 47, 95, 94], register: 3
moOmoOmoOMOoMOoMOo    # subtract 3 from 5th block						blocks: [10, 0, 32, 47, [92], 94], register: 3
Moo		      # print ASCII character 92 (backslash)					blocks: [10, 0, 32, 47, [92], 94], register: 3
mOomOomOomOoMoo	      # print newline								blocks: [[10], 0, 32, 47, 92, 94], register: 3
moOMMMmoOMMMMOOmoOmoOMoOmOomOoMOomooMMM # add 32 to 5th block					blocks: [10, 3, [32], 47, 124, 94], register: nil
moOmoOMMM             # copy 124 to register							blocks: [10, 3, 32, 47, [124], 94], register: 124
Moo	              # print ASCII character 124 (pipe)					blocks: [10, 3, 32, 47, [124], 94], register: 124
mOomOomOoMOOmoOMoomOoMOomoo # print n spaces							blocks: [10, [0], 32, 47, 124, 94], register: 124
MMMMoo	              # paste 124 to 2nd block and print as ASCII character			blocks: [10, [124], 32, 47, 124, 94], register: nil

Python 3, 41 bytes

lambda n:(f" /|{'_  '*n} \\|\n\n"*3)[::3]

Try it online!

How could I forget about f-strings?


Python 3, 43 bytes

lambda n:(" /|%s \\|\n\n"%("_  "*n)*3)[::3]

Try it online!

Constructs the string transposed, then transposes it using modular arithmetic.

Java 11, 61 bytes

n->" "+"_".repeat(n)+"\n/x\\\n|x|".replace("x"," ".repeat(n))

Try it online.

Explanation:

n->                  // Method with integer parameter and String return-type
  " "                //  Return a space
  +"_".repeat(n)     //  Appended with the input amount of "_"
  +"\n/x\\\n|x|"     //  Appended with "
                     //   /x\
                     //   |x|",
   .replace("x",     //  of which the "x" are replaced with:
     " ".repeat(n))  //   The input amount of spaces

Perl 5 -p, 32 bytes

$#_=$_;$_=$"._ x$_."
/@_\\
|@_|"

Try it online!

Explanation

Pretty straightforward, but the first part of this sets the last index of the undefined list @_ to the (implicit from -p) input ($_). $_ is then set to $" (space) followed by $_ _s, a literal newline, then /, and the interpolated empty list @_ that has a length of $_+1 which, when interpolated in a double quoted string places $" between each (empty) entry, resulting in $_ spaces, then \, a literal newline, then the same mechanism for the final line but using |.

R, 74 bytes

cat(" ",rep("_",n<-scan()),"\n","/",s<-rep(" ",n),"\\\n","|",s,"|",sep="")

Try it online!

I hit a dead end trying to golf this at 77 bytes (or even this).

C#, 97 bytes

string X(int n)=>$@" {R(n,'_')}
/{R(n)}\
|{R(n)}|";string R(int n,char c=' ')=>new string(c,n);

Try it online!

Python 3, 50 bytes

lambda x:print(f" {'_'*x}\n/{' '*x}\\\n|{' '*x}|")

if returning the string is acceptable instead of printing it it'd be 43 bytes

lambda x:f" {'_'*x}\n/{' '*x}\\\n|{' '*x}|"

brainfuck, 174 bytes

only works with input from 0 to 9, didn't think about this problem while writing the program

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

Try it online!

comments

++++[>++++<-]>  store 16 in cell 0
[               while cell 0 != 0
    -           cell 0 remove 1   total 0
    >++++++++   cell 1 add    8   total 128
    >+++        cell 2 add    3   total 48
    >++         cell 3 add    2   total 32
    >>          leave 2 empty cells
    >++++++     cell 6 add    6   total 96
    >++++++     cell 7 add    6   total 96
    >+          cell 8 add    1   total 16
    >+++        cell 9 add    3   total 48
    <<<<<<<<<   return to cell 0
]
>---->->>>,>->---->------ ajust cells to 0 124 47 32 0 0 92 95 10 48
                                            |   / space   \  _ \n  0
                          and take input into cell 5
>[-<<<<->>>>]             remove 48 from cell 5 
                          transforming the digit character into the numeric value
<<<<<<.                   print a space
>>[->.<<+>]               print n times _
>>>.                      print a new line
<<<<<<.                   print /
>>[-<.>>+<]               print n spaces
>>>.                      print \
>.                        print a new line
<<<<<<<.                  print |
>>>>[-<+<.>>]             print n spaces
<<<<.                     print |

brainfuck, 359 bytes, with input up to 255

input must take 3 characters, e.g. 42 must be inputted as 042

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

Try it online!

Create characters

++++[>++++<-]>  store 16 in cell 0
[               while cell 0 != 0
    -           cell 0 remove 1   total 0
    >++++++++   cell 1 add    8   total 128
    >+++        cell 2 add    3   total 48
    >++         cell 3 add    2   total 32
    >>          leave 2 empty cells
    >++++++     cell 6 add    6   total 96
    >++++++     cell 7 add    6   total 96
    >+          cell 8 add    1   total 16
    <<<<<<<<   return to cell 0
]
>---->->>>>->---->------  ajust cells to 0 124 47 32 0 0 92 95 10
                                            |   / space   \  _ \n

Input

>++++++++[->++++++<]>>-[>++<-----]>--<,>>,>++++++++++>,
    set cells :
        10 to 48
        11 to input 1
        12 to 100
        13 to input 2
        14 to 10
        15 to input 3
<<<<<                                move to cell 10
[->->>->>-<<<<<]                     remove 48 to cells 10 11 13 and 15
                                     getting digits from the characters
>[->[-<<+<+>>>]<<<[->>>+<<<]>>]      set cell 10 to cell 11 times cell 12
>[-]>[-<<+>>]>[-<<+>>]>[-<<+>>]<<<<< move cells 13 14 and 15 to cells 11 12 and 13 
>[->[-<<+<+>>>]<<<[->>>+<<<]>>]      add cell 11 times cell 12 to cell 10
>>[-<<<+>>>]<<<                      add cell 13 to cell 10
[-<<<<<+>>>>>]                       move cell 10 to cell 5
              

Actual drawings

<<<<<<<.                  print a space
>>[->.<<+>]               print n times _
>>>.                      print a new line
<<<<<<.                   print /
>>[-<.>>+<]               print n spaces
>>>.                      print \
>.                        print a new line
<<<<<<<.                  print |
>>>>[-<+<.>>]             print n spaces
<<<<.                     print |

brainfuck, 155 bytes, With input as brainfuck byte

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

Try it online!

++++[>++++<-]>  store 16 in cell 0
[               while cell 0 != 0
    -           cell 0 remove 1   total 0
    >++++++++   cell 1 add    8   total 128
    >+++        cell 2 add    3   total 48
    >++         cell 3 add    2   total 32
    >>          leave 2 empty cells
    >++++++     cell 6 add    6   total 96
    >++++++     cell 7 add    6   total 96
    >+          cell 8 add    1   total 16
    <<<<<<<<    return to cell 0
]
>---->->>>,>->---->------ ajust cells to 0 124 47 32 0 0 92 95 10
                                            |   / space   \  _ \n
                          and take input into cell 5

<<<<<.                    print a space
>>[->.<<+>]               print n times _
>>>.                      print a new line
<<<<<<.                   print /
>>[-<.>>+<]               print n spaces
>>>.                      print \
>.                        print a new line
<<<<<<<.                  print |
>>>>[-<+<.>>]             print n spaces
<<<<.                     print |
```

MAWP v1.1, 92 bytes

%@_1A84W;[1A~25WWM~]%!![1A92W1M5W;]%67M;85W7M;[1A84W;]%45W3M4W;67M;65W1M4W;[1A84W;]65W1M4W;.

Try it!

V (vim), 17 bytes

Àé_>>o/\Àé ÙÓÓ/|
Explain
À                  # @arg times
 é_                # <M-i>nsert a '_'
   >>              # indent by one space
     o/\           # insert '/\' on the next line (cursor stays at '\')
         Àé        # @arg times insert ' '
            Ù      # Duplicate this line down
             Ó /   # Find and replace ...
              Ó    # all Non-whitespace (\S == <M-S>)
                |  # with a '|'

Haven't done one of these in a while.

Try it online!

PowerShell, 43 41 bytes

-2 bytes thanks to mazzy

param($n)' '+'_'*$n
' '*$n|%{"/$_\
|$_|"}

Try it online!

Eh, it's okayslightly better

Alternative 41 byte solution offered by mazzy

Husk, 17 bytes

TJR⁰"_  "½" /| ¦|

Try it online!

Explanation

TJR⁰"_  "½" /| ¦|   Input is a number, say n = 3, accessed via ⁰.
          " /| ¦|   String literal " /| \|".
                    The parser replaces ¦ by \ and the closing " is implicit.
         ½          Split in half: x = [" /|", " \|"]
    "_  "           String literal.
  R⁰                Repeat n times: y = ["_  ", "_  ", "_  "]
 J                  Join x by this list: [" /|", "_  ", "_  ", "_  ", " \|"]
                    Since x and y are lists of strings, y is inserted between
                    each pair of elements in x and the result is flattened
                    to keep the types consistent.
T                   Transpose: [" ___ ", "/   \", "|   |"]
                    Implicitly print, separated by newlines.

Whitespace, 243 bytes

[S S S T    S T T   T   S S N
_Push_92_|][S S S N
_Push_0][S N
S _Duplicate_0][T   N
T   T   _Read_STDIN_as_integer][T   T   T   _Retrieve_input][N
S S N
_Create_Label_LOOP1][S N
S _Duplicate][N
T   S S N
_If_0_Jump_to_Label_DONE_WITH_LOOP1][S S S T    N
_Push_1][T  S S T   _Subtract][S S S N
_Push_0_space][S N
T   _Swap_top_two][N
S N
N
_Jump_to_Label_LOOP1][N
S S S N
_Create_Label_DONE_WITH_LOOP1][S N
N
_Discard_top][S S S T   S T T   T   S S N
_Push_92_|][S S T   T   S T T   S N
_Push_-22_newline][S S S T  T   T   T   S S N
_Push_60_\][S S S N
_Push_0][T  T   T   _Retrieve_input][N
S S T   N
_Create_Label_LOOP2][S N
S _Duplicate][N
T   S S S N
_If_0_Jump_to_Label_DONE_WITH_LOOP2][S S S T    N
_Push_1][T  S S T   _Subtract][S S S N
_Push_0_space][S N
T   _Swap_top_two][N
S N
T   N
_Jump_to_Label_LOOP2][N
S S S S N
_Create_Label_DONE_WITH_LOOP2][S N
N
_Discard_top][S S S T   T   T   T   N
_Push_15_/][S S T   T   S T T   S N
_Push_-22_newline][S S S N
_Push_0][T  T   T   _Retrieve_input][N
S S S T N
_Create_Label_LOOP3][S N
S _Duplicate][N
T   S T S N
_If_0_Jump_to_Label_PRINT_LOOP][S S S T N
_Push_1][T  S S T   _Subtract][S S S T  T   T   T   T   T   N
_Push_63__][S N
T   _Swap_top_two][N
S N
S T N
_Jump_to_Label_LOOP3][N
S S T   S N
_Create_Label_DONE_WITH_LOOP3][S S S T  S S S S S N
_Push_32][T S S S _Add][T   N
S S _Print_as_character][N
S N
T   S N
_Jump_to_Label_PRINT_LOOP]

Letters S (space), T (tab), and N (new-line) added as highlighting only.
[..._some_action] added as explanation only.

Try it online (with raw spaces, tabs and new-lines only).

Explanation in pseudo-code:

Push the codepoint of "|", minus the constant 32
Integer n = STDIN as integer
Integer t = n
LOOP1:
  If(t == 0):
    Jump to DONE_WITH_LOOP1
  t = t - 1
  Push codepoint of " ", minus the constant 32
DONE_WITH_LOOP1:
  Discard t
  Push "|\n\", minus the constant 32
  Integer t = n
LOOP2:
  If(t == 0):
    Jump to DONE_WITH_LOOP2
  t = t - 1
  Push codepoint of " ", minus the constant 32
DONE_WITH_LOOP2:
  Discard t
  Push "/\n"
  Integer t = n
LOOP3:
  If(t == 0):
    Jump to PRINT_LOOP
  t = t - 1
  Push codepoint of "_", minus the constant 32
PRINT_LOOP:
  (note, we don't discard t this time, since we need the codepoint of " " minus 32
   for the trailing character, which is just like t also 0)
  Print the top value + constant 32 as character to STDOUT
  Go to the next iteration of PRINT_LOOP

Uses this Whitespace tip of mine to print the output after pushing the characters in reversed order minus a certain constant, which will exit the program with an error as soon as we're done with printing and the stack is empty. The optimal constant 32 is generated by this Java program (based on \$n=1\$).

Charcoal, 11 bytes

↑|↗/×_N¶\¶|

Try it online! Link is to verbose version of code. This shape is too simple to tax Charcoal's drawing primitives, so this is just basically printing strings to the canvas. Explanation:

↑|

Print the left | and move the cursor up a line.

↗/

Print the / and move the cursor to the start of the _s.

×_N

Print the desired number of _s. This leaves the cursor just to the right of the last _.

¶\¶|

Move down a line, print a \, and print a | directly beneath.

Just for fun I thought I'd write a 25-byte version which allows you to vary the height and thickness too:

NθNηUOηN|↑G→↑η/↗UOθη_‖BOθ

Try it online! Link is to verbose version of code. Takes input as inner width, thickness and inner height. Note that Charcoal does not support zero-sized boxes, so all of the inputs need to be at least 1.

Retina, 22 bytes

.+
 $0*_¶/$0* \¶|$0* |

Try it online or verify a few more test cases.

Pretty straight-forward: convert the input to unary, using that amount of '_' ($0*_) and two times that amount of spaces ($0* ) respectively, surrounded with the rest of the output (leading space on the first line; surrounded with /\ on the second line; and surrounded with || on the third line).

PHP, 63 61 60 bytes

$a=++$argn;printf("%-'_{$a}s
/%{$a}s
|%{$a}s",' ','\\','|');

Try it online!

printf seemed the optimal way, but I may be wrong..

EDIT: saved 2 bytes with a multiline string

EDIT 2: saved another one by init $a before

C (gcc), 72 70 bytes

-2 bytes thanks to ceilingcat!

f(n){printf(" %s\n/%*c\n|%*2$c",memset(calloc(n,2),95,n),n+1,92,'|');}

Try it online!

05AB1E, 26 21 bytes

My original 26 bytes approach:

" 0 /1\|1|"3ô„_ vy¹иJNs:}»

Explanation:

" 0 /1\|1|"3ô„_ vy¹иJNs:}»
" 0 /1\|1|"                   push string template (the idea is to replace 0 and 1 with _ and space respectively using loop count index
           3ô                 split by chunks of 3
             „_               push 2 chars _ and space
               v        }     for each character in the previous string
                y¹и           repeat it by the number in input
                   J          join the new string
                    Ns        push the index before that string to easily replace
                      :       replace in the string template
                         »    join by new lines

Try It Online

21 bytes (@KevinCruijssen comments):

„_ S×ā" 1/2|2"2ô.º»r‡

Try It Online

Perl 5 -p, 40 bytes

say$"._ x$_,$/,$_='/'.$"x$_.'\\';y/ /|/c

Try it online!

05AB1E, 18 17 bytes

…_  ε×… /|NèºSsý,

Try it online or verify a few more test cases.

Explanation:

…_                 # Push string "_  "
    ε              # Map over each character in this string:
     ×             #  Repeat it the (implicit) input amount of times as string
      … /|         #  Push string " /|"
          Nè       #  Use the map-index to index into this string
            º      #  Mirror the character (" "→"  "; "/"→"/\"; "|"→"||")
             S     #  Convert the string to a pair of characters
              s    #  Swap so the "_"/" "-string is at the top of the stack
               ý   #  Join the pair with this string as delimiter
                ,  #  And output it with trailing newline

C (gcc), 109 91 bytes

Saved a whopping 18 bytes thanks to ceilingcat!!!

#define p printf(L"| |\\ / _ "+i)
i;j;f(n){for(i=9;i--;i--,p,puts(""))for(i-=p,j=n;j--;)p;}

Try it online!

Haskell, 58 bytes

f n|x<-' '<$[1..n]=' ':('_'<$x)++"\n/"++x++"\\\n|"++x++"|"

Try it online!

Japt, 20 bytes

" {ç'_}
/{ç}\\
|{ç}|

Try it

ç is one of Japt's repeat methods for integers; you can probably figure the rest out from there!

Pyth, 24 bytes

%" %s
/%s\\
|%s|"*RQ"_  

Try it online!

Explanation

%"..."*RQ"_
         "_    : The string literal "_  "
      *RQ      : Multiply each element of the string by input (["___", "   ", "   "])
%"..."         : Do string formating on string with args from previous comamnd

Io, 127 bytes

method(x,list(" _ ","/ \\","| |")map(i,list(i at(0)asCharacter,i at(1)asCharacter repeated(x),i at(2)asCharacter)join println))

Try it online!

i386 (16-bit mode) Bootsector, 512 bytes

All i386 bootsectors have to be 512 bytes, so... Without the padding required by i386, it is 137 bytes. Since I can't easily post a TIO link, here's a screenshot of it running: enter image description here

This code registers the BIOS interrupt int 0x69 to take the number in the bx register and use it as input. Thus, doing

mov bx, 3
int 0x69

is equivalent to the last test case. The disassembled, Intel-syntax source is:

[org 0x7c00]

xor ax, ax
mov es, ax
cli
mov dx, interrupt
mov [es:0x69*4], dx
mov ax, cs
mov [es:0x69*4+2], ax
sti

xor bx, bx
int 0x69
call newline
mov bx, 1
int 0x69
call newline
mov bx, 2
int 0x69
call newline
mov bx, 3
int 0x69
cli
hlt

interrupt:
or bx, bx
jz special
push bx
mov ax, 0x0e20
int 0x10
mov al, '_'
.loop1:
int 0x10
dec bx
jnz .loop1
call newline
mov al, '/'
int 0x10
mov al, ' '
pop bx
push bx
.loop2:
int 0x10
dec bx
jnz .loop2
mov al, '\'
int 0x10
call newline
mov al, '|'
int 0x10
pop bx
mov al, ' '
.loop3:
int 0x10
dec bx
jnz .loop3
mov al, '|'
int 0x10
iret

newline:
mov ax, 0x0e0d
int 0x10
mov al, 0x0a
int 0x10
ret

special:
mov si, s
mov ah, 0x0e
.sloop:
lodsb
int 0x10
or al, al
jnz .sloop
iret

s: db '/', '\', 10, 13, '|', '|'

times 510-($-$$) db 0
dw 0xaa55

(Bit verbose, I know, but hey, it's assembly.)

Perl 6, 49 bytes

Edit: -4 bytes

->$n {my$s=" "x$n;my$u="_"x$n;" $u\n/$s\\\n|$s|"}

Try it online!

C (gcc), 75 bytes

i;f(n){for(i=-1;n-i++;)putchar(i?95:32);printf("\n/%*c\n|%*c",i,92,i,124);}

Try it online!

Scala, 47 bytes

n=>print(s" ${"_"*n}\n/${" "*n}\\\n|${" "*n}|")

Longer version, 94 bytes

n=>print(Seq((' ',' ',"_"),('/','\\'," "),('|','|'," "))map(t=>t._1+t._3*n+t._2)mkString "\n")

Try them in Scastie

Python 2, 47 bytes

lambda n:" %s\n/%s\\\n|%s|"%("_"*n," "*n," "*n)

Try it online!

Inserting the n-dependent components into a template using string formatting.


48 bytes

lambda n:" "+"_"*n+"\n/"+" "*n+"\\\n|"+" "*n+"|"

Try it online!

Straight up concatenation.

JavaScript (ES8), 50 bytes

n=>` ${'_'.repeat(n)}
/${s=''.padEnd(n)}\\
|${s}|`

Try it online!


JavaScript (ES6), 50 bytes

n=>' '+`_
/ \\
| |`.replace(/_| /g,c=>c.repeat(n))

Try it online!

Jelly, 19 bytes

“_  ”ד  “/\“||”j"Y

A full program accepting a non-negative integer which prints the resulting ASCII art.

Try it online!

How?

“_  ”ד  “/\“||”j"Y - Main Link: integer, n (e.g. 3)
“_  ”               - list of characters = ['_', ' ', ' ']
     ×              - multiply -> ['___', '   ', '   '] (now strings, a bit of a hack in Jelly)
      “  “/\“||”    - list of lists of characters = [[' ', ' '], ['/', '\'], ['|', '|']]
                 "  - zip together applying:
                j   -   join -> [[' ', '___', ' '], ['/', '   ', '\'], ['|', '   ', '|']]
                  Y - join with newlines -> [' ', '___', ' ', '\n', '/', '   ', '\', '\n', '|', '   ', '|']
                    - implicit, smashing print
                      >>> ___ 
                      >>>/   \
                      >>>|   |

Python 3, 57 bytes

lambda x:[print(z+y*x+a)for y,z,a in["_  "," /\\"," ||"]]

Try it online!

MATL, 20 bytes

' /|'4i:)B95*' \|'v!

Try it online!

How it works

' /|'   % Push this string: first column of the output, but as a row (*)
4       % Push 4
i:)     % Implicitly input n; range; modular indexing. This gives a row vector
        % [4 4 ... 4] of length n
B       % Convert to binary. Each number gives a row in the output. So this
        % produces the matrix [1 0 0; 1 0 0; ...; 1 0 0] with n rows
95*     % Multiply each entry by 95 (ASCII code of '_'). This gives the central
        % columns of the output, but transposed, as an n×3 matrix (**)
' \|'   % Push this string: last column of the output, but as a row (***)
v       % Concatenate (*), (**) and (***) vertically
!       % Transpose. Implicitly display

Ruby, 57 bytes

n=gets.to_i
$><<' '+?_*n+" \n/"+' '*n+"\\\n|"+' '*n+'|'

Try It Online!

Ruby, 36 bytes

->n{" #{?_*n}
/#{a=" "*n}\\
|#{a}|"}

Try it online!

APL (Dyalog Unicode), 21 bytes (SBCS)

Full program, prompting for n from stdin.

' /|',' \|',⍨3↑1⎕⍴'_'

Try it online!

'_' an underscore

1⎕⍴'_' cyclically reshaped into a matrix with one row and n columns

3↑ take the first three rows, padding with spaces

' \|',⍨ append this character-list as a trailing column

' /|', prepend this character-list as a leading column