| Bytes | Lang | Time | Link |
|---|---|---|---|
| 056 | Excel | 201016T183403Z | Engineer |
| 038 | Raku Perl 6 rakudo | 251002T132111Z | xrs |
| 052 | AWK | 251001T173345Z | xrs |
| 031 | Ly | 220604T091809Z | cnamejj |
| 055 | Python 3 | 220604T083827Z | Sapherey |
| 018 | Vyxal j | 220602T204400Z | naffetS |
| 059 | JavaScript | 220602T223149Z | Matthew |
| 056 | Factor | 220602T214113Z | chunes |
| 028 | Pyth | 220307T162717Z | sinvec |
| 123 | Batch | 210501T055941Z | T3RR0R |
| 111 | Whispers v2 | 210207T162145Z | Razetime |
| 092 | Whispers v2 | 210209T032014Z | Leo |
| 089 | Forth gforth | 201108T124043Z | Razetime |
| 053 | Bash | 201108T134759Z | F. Hauri |
| 012 | Canvas | 201104T034604Z | Razetime |
| 097 | ><> | 201016T215053Z | tjjfvi |
| 045 | Rust | 200803T175806Z | TehPers |
| 031 | Integral | 200803T154556Z | nph |
| 015 | Cinnamon Gum | 201015T003810Z | Sisyphus |
| 025 | CJam | 201014T082709Z | Dion |
| 095 | MAWP 1.1 | 200803T164829Z | Dion |
| 041 | MAWP 2.0 | 200908T071210Z | Dion |
| 032 | MATLAB/Octave | 200805T091945Z | Tom Carp |
| 118 | Pepe | 200810T014247Z | u-ndefin |
| 174 | 1+ | 200808T112313Z | Twilight |
| 420 | COW | 200808T144345Z | Dingus |
| 041 | Python 3 | 200806T032703Z | Kyuuhach |
| 061 | Java 11 | 200805T075838Z | Kevin Cr |
| 032 | Perl 5 p | 200804T190259Z | Dom Hast |
| 074 | R | 200806T145132Z | Giuseppe |
| 097 | C# | 200806T140155Z | Regin La |
| 050 | Python 3 | 200806T073413Z | Brian H. |
| 174 | brainfuck | 200805T143111Z | jonatjan |
| 092 | MAWP v1.1 | 200806T064129Z | Razetime |
| 017 | V vim | 200806T044520Z | nmjcman1 |
| 041 | PowerShell | 200804T154407Z | Veskah |
| 017 | Husk | 200805T110302Z | Zgarb |
| 243 | Whitespace | 200805T090759Z | Kevin Cr |
| 011 | Charcoal | 200803T184813Z | Neil |
| 022 | Retina | 200805T083246Z | Kevin Cr |
| 060 | PHP | 200804T104708Z | Kaddath |
| 070 | C gcc | 200804T025559Z | gastropn |
| 021 | 05AB1E | 200803T190752Z | SomoKRoc |
| 040 | Perl 5 p | 200804T134846Z | Xcali |
| 017 | 05AB1E | 200804T092545Z | Kevin Cr |
| 091 | C gcc | 200803T184231Z | Noodle9 |
| 058 | Haskell | 200804T091423Z | ovs |
| 020 | Japt | 200803T195004Z | Shaggy |
| 024 | Pyth | 200804T074837Z | Mukundan |
| 127 | Io | 200804T051414Z | user9649 |
| 512 | i386 16bit mode Bootsector | 200804T032629Z | sugarfi |
| 049 | Perl 6 | 200804T024121Z | sugarfi |
| 075 | C gcc | 200803T194501Z | att |
| 047 | Scala | 200803T221639Z | user |
| 047 | Python 2 | 200803T205909Z | xnor |
| 050 | JavaScript ES8 | 200803T160225Z | Arnauld |
| 019 | Jelly | 200803T170431Z | Jonathan |
| 057 | Python 3 | 200803T165446Z | hyperneu |
| 020 | MATL | 200803T163036Z | Luis Men |
| 057 | Ruby | 200803T160848Z | Razetime |
| 036 | Ruby | 200803T160133Z | Dingus |
| 021 | APL Dyalog Unicode | 200803T155848Z | Adá |
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.
Raku (Perl 6) (rakudo), 38 bytes
{" {'_'x$_}\n/{' 'x$_}\\\n|{' 'x$_}|"}
Doesn't work on ATO, but I'll leave the link for, uh... posterity.
Ly, 42 31 bytes
"| |\ / - "nsp[ol[f:of,]ppo9`o]
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
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):`
/\\
||
`
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] ]
! 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.
Batch 154 151 143 133 123 bytes
Notes:
- start from
cmd.exe's command line with arg%1as integer - Output will be line wrapped unless console is resized to a number of columns that supports
%1 - line
1has a trailing Space - Requires windows 10 / virtual terminal support
ESCis a stand in for the ansii escape character 0x027- Raw code including the character can be found here
- Or the character can be generated by opening the command prompt and typing:
>"%TEMP%\escape.chr" Echo(ALT+027 then pressing ENTER
- Or output using a for loop with
Echo off:(For /F "skip=4 DELIMS=" %a in ('Echo(prompt $E^|cmd')Do Echo(%a) >"%TEMP%\escape.chr"
- Or the character can be generated by opening the command prompt and typing:
@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:
- virtual teminal positioning codes to position cursor for wall pieces and to effect new lines (
ESC[1E) where needed. - a for loop macro outputs the crest and whitespace between wall sides
-'
ESC7Space' is used to allow leading whitespace to be output using<nul set /p =string - Cursor positioning is enacted relative to the initial cursor position
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
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
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 ;
-8 bytes from Bubbler.
Forth goes into infinite loops when given 0 for a Otherwise, this function is pretty straightforward.do loop, since every loop must run atleast once. So a for loop with an if statement is used.
><>, 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)
Old answer (76 bytes):
|n|format!(" ")+&"_".repeat(n)+"
/"+&" ".repeat(n)+"\\
|"+&" ".repeat(n)+"|"
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!
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
CJam, 25 bytes
S'_qi:A*N'/' A*:Z'\N'|Z'|
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;.
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
.
MATLAB/Octave, 36 32 bytes
@(n)[' /|';'_ '+~(1:n)';' \|']'
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(...).
- Saved 4 bytes by duplicating the string literal using array expansion rather than with
repmat. Thanks @LuisMendo.
Pepe, 118 bytes
REeEeEEEEErEeErREEeeeEReREEEEEEeRREeeEeeeeeReeereeEreeeEeEEEEREEEEeeEREEeeeEReeereeEeEEEeereeERrEeEEEEEeerreEeReeereEe
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
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]
How could I forget about f-strings?
Python 3, 43 bytes
lambda n:(" /|%s \\|\n\n"%("_ "*n)*3)[::3]
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))
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$_."
/@_\\
|@_|"
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="")
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);
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
++++[>++++<-]>[->++++++++>+++>++>>>++++++>++++++>+>+++<<<<<<<<<]>---->->>>,>->---->------>[-<<<<->>>>]<<<<<<.>>[->.<<+>]>>>.<<<<<<.>>[-<.>>+<]>>>.>.<<<<<<<.>>>>[-<+<.>>]<<<<.
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
++++[>++++<-]>[->++++++++>+++>++>>>++++++>++++++>+<<<<<<<<]>---->->>>>->---->------>++++++++[->++++++<]>>-[>++<-----]>--<,>>,>++++++++++>,<<<<<[->->>->>-<<<<<]>[->[-<<+<+>>>]<<<[->>>+<<<]>>]>[-]>[-<<+>>]>[-<<+>>]>[-<<+>>]<<<<<>[->[-<<+<+>>>]<<<[->>>+<<<]>>]>>[-<<<+>>>]<<<[-<<<<<+>>>>>]<<<<<<<.>>[->.<<+>]>>>.<<<<<<.>>[-<.>>+<]>>>.>.<<<<<<<.>>>>[-<+<.>>]<<<<.
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
++++[>++++<-]>[->++++++++>+++>++>>>++++++>++++++>+<<<<<<<<]>---->->>>,>->---->------<<<<<.>>[->.<<+>]>>>.<<<<<<.>>[-<.>>+<]>>>.>.<<<<<<<.>>>>[-<+<.>>]<<<<.
++++[>++++<-]> 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;.
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.
PowerShell, 43 41 bytes
-2 bytes thanks to mazzy
param($n)' '+'_'*$n
' '*$n|%{"/$_\
|$_|"}
Eh, it's okayslightly better
Husk, 17 bytes
TJR⁰"_ "½" /| ¦|
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",' ','\\','|');
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,'|');}
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
21 bytes (@KevinCruijssen comments):
„_ S×ā" 1/2|2"2ô.º»r‡
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;}
Japt, 20 bytes
" {ç'_}
/{ç}\\
|{ç}|
ç 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"_
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))
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:

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.)
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);}
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")
Python 2, 47 bytes
lambda n:" %s\n/%s\\\n|%s|"%("_"*n," "*n," "*n)
Inserting the n-dependent components into a template using string formatting.
48 bytes
lambda n:" "+"_"*n+"\n/"+" "*n+"\\\n|"+" "*n+"|"
Straight up concatenation.
JavaScript (ES8), 50 bytes
n=>` ${'_'.repeat(n)}
/${s=''.padEnd(n)}\\
|${s}|`
JavaScript (ES6), 50 bytes
n=>' '+`_
/ \\
| |`.replace(/_| /g,c=>c.repeat(n))
Jelly, 19 bytes
“_ ”ד “/\“||”j"Y
A full program accepting a non-negative integer which prints the resulting ASCII art.
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
>>> ___
>>>/ \
>>>| |
MATL, 20 bytes
' /|'4i:)B95*' \|'v!
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
APL (Dyalog Unicode), 21 bytes (SBCS)
Full program, prompting for n from stdin.
' /|',' \|',⍨3↑1⎕⍴'_'
'_' 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

