[Question]
  [
Given a positive integer \$n\$ output an ASCII hexagon with diagonal side length \$n\$, as pictured (note there are \$2n\$ `_` characters on the top edge)
### Examples:
\$n = 1\$
```
 __
/  \
\__/
```
\$n = 2\$
```
  ____
 /    \
/      \
\      /
 \____/
```
\$n = 5\$
```
     __________
    /          \
   /            \
  /              \
 /                \
/                  \
\                  /
 \                /
  \              /
   \            /
    \__________/
```
etc.
Shortest code in bytes wins.
[Usual input/output methods](https://codegolf.meta.stackexchange.com/questions/2447/default-for-code-golf-input-output-methods) apply.
  
[Answer]
# [Canvas](https://github.com/dzaima/Canvas), ~~15~~ 9 [bytes](https://github.com/dzaima/Canvas/blob/master/files/chartable.md)
```
 _；１＊⁸／∔╬
```
[Try it here!](https://dzaima.github.io/Canvas/?u=JTIwXyV1RkYxQiV1RkYxMSV1RkYwQSV1MjA3OCV1RkYwRiV1MjIxNCV1MjU2Qw__,i=NQ__,v=8), [another 9 bytes](https://dzaima.github.io/Canvas/?u=XyVENyUyMCV1MjA3OCV1RkYzQyV1MjIxNCV1RkYwQiV1MjE5NCV1MjU2Qw__,i=NQ__,v=8)
-6 bytes after fixing the program.
Draws a quarter of the hexagon, and quad palindromizes.
[Answer]
# [Python 2](https://docs.python.org/2/), 92 bytes
```
k=n=input()
while 1:a=k^k>>n;print" "*a+"\/_"[k/n-2]+"_ "[-n<k<n]*2*(2*n+~a)+"\_/"[k/n];k-=1
```
[Try it online!](https://tio.run/##K6gsycjPM/r/P9s2zzYzr6C0REOTqzwjMydVwdAq0TY7LtvOLs@6oCgzr0RJQUkrUVspRj9eKTpbP0/XKFZbKV5BKVo3zybbJi9Wy0hLw0grT7suUROoKF4frCjWOlvX1vD/f1MA "Python 2 – Try It Online")
[Answer]
# [C (gcc)](https://gcc.gnu.org/), ~~119~~ 109 bytes
```
a,i,j;f(n){for(i=a+=a=j=n*2;~j;)putchar(!i--?i=a,j--,13:i%(n*3)<n|j%(n*2)?(i-~j-n)%a?(i-j+n)%a?32:92:47:95);}
```
[Try it online!](https://tio.run/##JczRCoIwGIbhc69iEcJ@3QKnEW4ur2WszH/UDNMj01tfmkfPCx98lj@sDcEwZE411MPUdD1FbVJttNM@EWpxCt7jYFvT0wNyXq8rc5yzLJcYU5/kUPmv20pATZEvjnuIzZYu/VcuZClkcZHlGdQcjujtc7zdSfUZbtid2muEfiAvg54CmSLS0AzUhtjJd4qd9SOaww8 "C (gcc) – Try It Online")
* saved 2 thanks to @ceilingcat
The table below is not updated so values can differ, but the concept is:
* we have 2 pairs of parallel lines
```
        .    .
_______.______.________   
  |   /        \   |  .
. |  /          \  | .
 .| /            \ |.
  |/              \|
  |\              /|.
 .| \            / | .
. |  \          /  |
__|___\________/___|___   
  |    .      .
```
we iterate x,y from size to 0 and we sum them to check if a / should be printed, we subtract to check for \ , we use modulo to check both parallels.
```
    i 65432109876543210. j
 i+j-n    ________      8 
13+7-4=> /        \     7 
14+6-4  /          \    6 
15+5-4 /            \   5 
      /              \  4 
      \     1+3-4=>  /  3
       \    2+2-4   /   2
        \   3+1-4  /    1
         \________/     0
```
[Answer]
# [Charcoal](https://github.com/somebody1234/Charcoal), 14 bytes
```
←×_θ↖θ→↗θ×_θ‖Ｍ
```
[Try it online!](https://tio.run/##S85ILErOT8z5//9R24TD0@PP7XjUNg1ETHrUNv3cDohIw7T3e9b@/x9taBD7XzcRAA "Charcoal – Try It Online")
+1 byte fix from ASCII-Only.
Draws half of the hexagon, and mirrors it.
[Answer]
# [Haskell](https://www.haskell.org/), 100 bytes
```
f n=unlines[q<$>[1..3*n]++[1-n..0]|y<-[-n..n],let q x|abs y==n,x>n='_'|x==y='\\'|x+y==1='/'|1>0=' ']
```
[Try it online!](https://tio.run/##FY1BCsMgEAC/sofCQk1spNBT1h/01KORYMHSULMk1UAC/t3a28DAzNvFjw@hlBcwbRwm9tGs/UkbJeX1zFYIo1qWsrP56FvzR7ZN8AlW2LN7RjiIuNk1E46Yd6KDcBgqiSoU4QWz0h0hoC2zm5hmt9xHWLb0SF8w9Zu5huvuZm35AQ "Haskell – Try It Online")
Golfing [AZTECCO's answer](https://codegolf.stackexchange.com/a/217486/20260) plus some new techniques.
The main idea is that the hexagon is simpler if we transplant the first `n` columns to the end.
```
|-|
   ______   
  /      \  
 /        \ 
/          \
\          /
 \        / 
  \______/  
         |-|
______      
      \    /
       \  / 
        \/  
        /\  
       /  \  
______/    \
```
Now all the `/` and `\` are in a single line, and the `_` are all to the left of those. This makes it much easier to do AZTECCO's strategy of determining the character from the coordinate. To implement these relabeled coordinates, we replace the `x`-coordinates `[1..4*n]` with a cycled and shifted version `[1..3*n]++[1-n..0]`.
[Answer]
# [Perl 5](https://www.perl.org/) (`-p`), 102 bytes
```
s/_+/__$&/g,s/^|$/ /gm,s/^ *\S /$&  /gm,s-( +)\\ 
-$&/ $1 \\
\\ $1 /
- for($\=' __ 
/  \
\__/')x--$_}{
```
[Try it online!](https://tio.run/##JYy9CsJAEIT7e4ohLPkxrmuEVJJHsLJdXCxMCKgJOQsl5tU9T@y@mW@Y8TJd69C3OWkx@/OLdE/aJMkSvFgpZpRKt/ZyepNAutsPsdIjhFL8C85RFqpwHLegCqouxgjiGO0wxe8mgxmcANGZSVY8mcmWOYTK7Vz9GcZHP9x94DHwod5sqy8 "Perl 5 – Try It Online")
`-p` and `}{` at the end is a trick to only print the output record separator `$\` at the end. It only works for one input record; the header is used to print all in one tio link.
```
$\=' __ 
/  \
\__/'   # output record separator initialized with hexagon (size 1)
s/_+/__$&/g,s/^|$/ /gm,s/^ *\S /$&  /gm,s-( +)\\ 
-$&/ $1 \\
\\ $1 /
- # regexes to increase the hexagon by 1
for .. --$_ # to repeat n-1 times where n is the input
```
[Answer]
# [Haskell](https://www.haskell.org/), 150 bytes
```
r=reverse
m(o:c:k)=o:c:c:c:k++" "
f 1=[["\\  /","__ "],["/__\\"]]
f n|[w:i,j]<-map m<$>f(n-1),_:_:k<-r$m w=[r k:w:i,k:j]
h[i,j]=unlines$r<$>r i++j
h.f
```
[Try it online!](https://tio.run/##FYuxDoMgFEV3vuKFMNiANSadiPQnOgIhpkFFhBrUuvTfqeQMdzj3TP3m7bLknESyX5s2i0L14W/ub6JMwVOKAaMBWiElVgqgwQwbA1gziRtjlMJaXz7@5Mkdm3VXh36F0JHnUMW6vTHDDfddnUiAU8gEnpej57NGkyyFOOLiot1IuqIEjtIZjWK6Dzn0Lor12F97IiM88h8 "Haskell – Try It Online")
A more recursive version of this answer. The arbitrariness of this challenge makes this pretty frustrating.
## Explanation
This answer is a bit hard to explain. The challenge is, as I already said, arbitrary in a few ways, so the code is sort of just a nest of symbols.
### Idea
The idea of the program here is to build up the two halves. That is when calculating the nth hexagon we get the two halves for the n-1th hexagon and use that to make the next biggest one.
There are some caveats though. We build the top half up-side-down and we build both halves mirrored left to right. We do this because it is convenient to do it this way. No deep reason it just makes things shorter even if it does make things a little incomprehensible.
### Details
The first line is pretty straight forward `r` is an alias for `reverse`. The second line is not so straight forward. `m` is a nonsense function, it exists because it or a similar operation needs to be done in a few places. It doesn't really have a semantic meaning. The best explanation of what it does here is the code.
```
m(o:c:k)=o:c:c:c:k++" "
```
From here we start getting to `f` which handles basically all of the logic. The first case for `f` is the base case, it is pretty standard
```
f 1=[["\\  /","__ "],["/__\\"]]
```
Note that we return a list of two items instead of a tuple. In any sane program we would be using a tuple since it is fixed at 2 elements. However later we will map over both arguments of this with the same function. It is hard to do that with a tuple but easy with a list, and the list doesn't pose any drawbacks so we use it.
Then we have the inductive case. First we fetch the previous case, and double map our `m` over it. This makes the hexagon 1 unit wider (2 characters) and moves it half a unit (1 character) to the right (although since this whole thing is backwards the space characters are added on the *right*). We pattern match this to `[w:i,j]` because we want to use `w` to make new rows later. Speaking of which next we make the rows. We do this with a pattern match:
```
_:_:k<-r$m w
```
This is sort of nonsense code. It just slaps together things we already had to produce the correct output. `k` and its reverse form the new rows so we add them in. and return that.
After `f` we have `h` which turns the output of `f` into a string. It undoes all the wacky transforms we used during the construction and packages it up to be used.
With all that we just compose `f` and `h` for the final function.
[Answer]
# [Retina 0.8.2](https://github.com/m-ender/retina/wiki/The-Language/a950ad7d925ec9316e3e2fb2cf5d49fd15d23e3d), 94 bytes
```
.+
$* ¶$&$* 
\G 
¶$%'/$`$%_$%_$`\
r` \G
$%`\$'$%_$%_$%'/¶
^¶( *)
$1 $.&$*_$.&$*_$&
T` `\_` +/$
```
[Try it online!](https://tio.run/##LYw9CoAwFIP3nOINqb@gKHiGXsDxYZ@Dg4uDeLYeoBerFYSQfISQ@3jOa8@u8ZaHHuwkRVYloF5Q2NUjjS58MsVtoh50pqz/tixSxJZiI10LTsKhHITfK6wmpsGkH5nzhBnLCw "Retina 0.8.2 – Try It Online") Link includes test cases. Explanation:
```
.+
$* ¶$&$* 
```
Insert two rows of `n` spaces.
```
\G 
¶$%'/$`$%_$%_$`\
```
Convert the first row into the top sides of the hexagon.
```
r` \G
$%`\$'$%_$%_$%'/¶
```
Convert the second row into the bottom sides of the hexagon.
```
^¶( *)
$1 $.&$*_$.&$*_$&
```
Insert the top line.
```
T` `\_` +/$
```
Replace the bottom line.
[Answer]
# [Python 2](https://docs.python.org/2/), ~~119~~ 114 bytes
```
i=n=input()
d=0
exec"k=i/n|d;print' '*i+'\_/'[~k]+'_ '[i-d<n]*2*(2*n+~i)+'\_/'[k]\nif i==d:d=i=-1\ni-=d|1;"*(n-~n)
```
[Try it online!](https://tio.run/##LcpLCsIwEADQfU8Rupl8CDVZWuckbejCqTgExiARFEquHl24fPDKp94fEntnFGQpr6rNQHga9vd@HTPyJAfN5clSQYFlB@s2wdJycrApWNjTRZKNVkcrrrH5h5xW4ZtiRDoTMvrws0c6wjxaLb6J6T18AQ "Python 2 – Try It Online")
[Answer]
# JavaScript (ES6), ~~109~~ 107 bytes
```
w=>(x=0,W=w*4,i=g=y=>~y?`
 /\\_`[x++-W?y*!i|w/x|x>w*3?(x+~y+w)%W?(x+y)%W-w?1:3:2:4:x=i=0&y--]+g(y):'')(w*2)
```
[Try it online!](https://tio.run/##Zci9DoIwFEDhnafQQeltqciPS5NLH4NBjBAEgiHUiLFtQnj1qqNhOiffvXpXU/3sHy8@qlvjWnQaM2LwGOSoaRr02KHFbLGy9DZhUVzLs2GM59LSbT/r0Mwm0zSRxLDFMg27/Lf2W65lJBIRi1QY7PG4t5xfWEcsCN8HomkMrlbjpIbmMKiOtCQC8P4lXkmykhOA@wA "JavaScript (Node.js) – Try It Online")
### Commented
```
w => (                        // w = input
  x = 0,                      // initialize x to 0
  W = w * 4,                  // W = total width
  i =                         // initialize i to a non-zero value
  g = y =>                    // g is a recursive function taking y
  ~y ?                        //   if y is not equal to -1:
    `\n /\\_`[                //     list of characters
      x++ - W ?               //     if this is not the end of the row:
        y * !i |              //       if this is neither the first nor the last row
        w / x |               //       or x is less than or equal to w
        x > w * 3 ?           //       or x is greater than w * 3:
          (x + ~y + w) % W ?  //         if (x - y - 1 + w) mod W is not equal to 0:
            (x + y) % W - w ? //           if (x + y) mod W is not equal to w:
              1               //             draw a space
            :                 //           else:
              3               //             draw a '\'
          :                   //         else:
            2                 //           draw a '/'
        :                     //       else:
          4                   //         draw a '_'
      :                       //     else:
        x = i = 0 & y--       //       decrement y, set x and i to 0 and draw a linefeed
    ] + g(y)                  //     append the result of a recursive call
  :                           //   else:
    ''                        //     stop the recursion
)(w * 2)                      // initial call to g with y = w * 2
```
[Answer]
# [C (gcc)](https://gcc.gnu.org/), ~~194~~ \$\cdots\$ ~~149~~ 144 bytes
Saved ~~13~~ ~~14~~ 19 bytes thanks to [ceilingcat](https://codegolf.stackexchange.com/users/52904/ceilingcat)!!!
```
p(n,c){for(;n--;)printf(L"/\\ _\n"+c);}i;t;f(n){p(n,2);for(i=t=p(2*n,3);i>=p(1,4);t=i/n?--i,1:t)i+=!p(!p(n+i<<!p(!p(n+~i,2),t),t&!i|2),!t)-2*t;}
```
[Try it online!](https://tio.run/##NY5BCsJADEX3PUXahUw6M5RW3ZiOXsAjFEQGKlkYS5ldrVevacXwIT/hkZ/oHzEuy2DERZz612hIvCccRpbUm2tRdR3cOilsRJqZEvVGcFr5BmnlOaQwmKYUt0fis/raHZBS4Eou3rOrTwnZhnwwKrHctn/7YT3ikmqX81ttntA3ZaJ50XR43lkMZlMGWhoFZt0KBKhJWxvgSGCtIPyQDdPvaJvmbF6@ "C (gcc) – Try It Online")
### Explanation (before some golfs)
```
p(n,c){for(;n--;)                     // Helper function to print  
         putchar("/\\ _\n"[c]);}      //  one of '/', '\', ' ', '_' , or  
                                      //  newline n times, this function  
                                      //  also returns 0 
i;t;f(n){                             // Main function prints an n hexagon  
        p(n,2);                       // Print n leading spaces for the 1st  
                                      //  line 
        for(                          // Main loop
            i=t=p(2*n,3);             // Set i and t to 0,  
                                      //  and print 2*n '_'s for the 1st line
            i>=p(1,4);                // Loop until i goes below 0, and 
                                      //  print a newline
                                      // At the end of each loop:  
            i+=1-2*t,                 //  increment i for the 1st half  
                                      //   and then decrement i in the 2nd  
            t=i/n?--i,1:t)            //  keep t as t unless i equals n,   
                                      //  then make t 1 and decrement i   
                                      // In the main loop:
                p(n+~i,2),            //  print n-i-1 leading spaces     
                p(1,t),               //  print a '/' in the 1st half and a  
                                      //   '\' in the 2nd    
                p(n+i<<1,t&!i|2),     //  print the 2*(n+i) middle spaces  
                                      //   unless at the bottom print '_'s  
                p(1,!t);              //  print a '\' in the 1st half and a  
                                      //   '/' in the 2nd    
   }  
 
```
[Answer]
# [05AB1E](https://github.com/Adriandmen/05AB1E), ~~33~~ ~~29~~ 25 bytes
-4 ([7](https://codegolf.stackexchange.com/questions/217366/draw-an-ascii-hexagon-of-side-length-n/217393?noredirect=1#comment507103_217393)) bytes thanks to [Kevin Cruijssen](https://codegolf.stackexchange.com/users/52210/kevin-cruijssen)!
```
L+<'/úíºI·'_×š»∊¶¡`ðs‡).c
```
[Try it online!](https://tio.run/##ATIAzf9vc2FiaWX//0wrPCcvw7rDrcK6ScK3J1/Dl8WhwrviiIrCtsKhYMOwc@KAoSkuY///NQ "05AB1E – Try It Online")
*05AB1E* has a canvas builtin which might be useful, but is quite tricky to get working, this is just the mirror builtins `º` and `∊` and the centralize builtin `.c`.
[Answer]
# [J](http://jsoftware.com/), 50 47 bytes
*-3 thanks to Jonah!*
```
' \/_'{~]|."1((0,]+2*|.)@=@i.,.3,3,~0$~<:,])@+:
```
[Try it online!](https://tio.run/##y/qvpKeepmBrpaCuoKNgoGAFxLp6Cs5BPm7/1RVi9OPVq@tia/SUDDU0DHRitY20avQ0HWwdMvV09Ix1jHXqDFTqbKx0YjUdtK3@a3KlJmfkK6QpGEIY6uowASN0AdP/AA "J – Try It Online")
```
((0,]+2*|.)@=@i.  ,.  3,3,~0$~<:,])@+:
     0 0 0 0            3 3 3 3
     1 0 0 2            0 0 0 0
     0 1 2 0            0 0 0 0
     0 2 1 0            0 0 0 0
     2 0 0 1            3 3 3 3
    ]|."1
0 0 3 3 3 3 0 0
0 2 0 0 0 0 1 0
2 0 0 0 0 0 0 1
1 0 0 0 0 0 0 2
0 1 3 3 3 3 2 0
' \/_'{~ 
  ____
 /    \    
/      \    
\      /  
 \____/  
```
[Answer]
# [Python 3.8 (pre-release)](https://docs.python.org/3.8/), 174 bytes
```
n=int(input())
b,a,s="\/ "
z,f=range(n),lambda c,d,t:((n-1-i)*s+c+2*(n+i)*s+d for i in t)
print(f"{'_'*2*n:^{4*n}}",*f(a,b,z),*f(b,a,z[:0:-1]),f"{b:>{n}}{'_'*2*n}/",sep="\n")
```
[Try it online!](https://tio.run/##NY5LDoIwFEXnrKLphLY8gqAmpgluxF9aoNpEH02pAyGsvYKJszM49@M@4dHj9uB8jFhbDMyiewfGeaJBwVDTc0FoMoKpvcJ7x5DDU710q0gDLQTJGOZlbrkYsiarBMPsxy0xvSeWWCSBJ86vzYZO6S0VlUB5nXYC55mCMEyBhpGvtC6OJ7mReXnhsOhaHqdF@8fmgsLQueUTUh7j/gs "Python 3.8 (pre-release) – Try It Online")
-1 byte thanks to @Duncan
-8 bytes thanks to @Danis
[Answer]
# [Haskell](https://www.haskell.org/), ~~129~~ 120 bytes
```
g=mod
f n|a<-n*4=[c|y<-[-n..n],x<-[0..a],let c|x<1='\n'|g x(n*3+1)>n,abs y==n='_'|g(x+y)a==1='/'|g(x-y)a<1='\\'|1>0=' ']
```
[Try it online!](https://tio.run/##HY7NDoIwEITvPsXeyl8rjcYTyxt48ggNWRHRCCsRTErSd6@V23yZmcw8aH51w@B9j@P7trsDOyokJ0esWrcWspKsFJvMBpkrRSYbugVaZwuNombherARJ4dUxyVndJ1hRWQUTXAim64xIYbkfkMZcOvVwukyRwHC@JGejCNN5wam73JZPlD9X3AY1EqdjPE/ "Haskell – Try It Online")
* saved 9 thanks to @Wheat Wizard and @xnor.
* Check @xnor answer and its big improvement on the approach to the problem (avoiding modulo and parallel lines) !
* Equivalent of my C answer
We make cartesian coordinates using list comprehension |y<-[0..n\*2],x<-[0..a]
[c| ... ,let c| ... | ... | ... ] and we yeld the character needed based on x-y or x+y to draw lines..   
We use modulo to draw multiple lines(2)   
Special case is for `_` which doesn't need a x/y ratio but a range, we used modulo to do just one comparison `>` instead of an a>x>b like
[Answer]
# [SlimSharp](https://github.com/jcoehoorn/SlimSharp/), 150 bytes
```
I n=RI(),m=n;S b=new S('-',n*2).Pad(n*-3),l="/",r="\\";Action<I> x=a=>P(l.Pad(-a).Pad(4*n-a)+r);P(b);for(;m>0;)x(m--);l=r;r="/";for(;m<n;)x(++m);P(b);
```
> 
> <https://dotnetfiddle.net/iXLzcO>
> 
> 
> 
The fiddle differs slightly from the post because .Net Fiddle can't use the RI() function to read from the console.
This is still the naiive version, without any recursive or coordinate mapping tricks. I'm unlikely to get shorter, because SlimSharp hasn't defined shortcuts for some of the relevant array and string functions yet.
---
# C#, 227 bytes
The full C# looks like this, and that's still assuming all the necessary `using` directives and that we get to abstract to a method.
```
void H(int n){int m=n;string b=new string('-',n*2).PadLeft(n*3),l="/",r="\\";Action<int> x=a=>Console.WriteLine(l.PadLeft(a).PadRight(4*n-a)+r);Console.WriteLine(b);for(;m>0;)x(m--);l=r;r="/";for(;m<n;)x(++m);Console.Write(b);}
```
[Answer]
# [Ruby](https://www.ruby-lang.org/), 141 bytes
```
->(n,g=->c,d{(1..n).map{|i|" "*(n-i)+d+" "*2*(n+i-1)+c}},l=g[?/,e=?\\].reverse){[" "*n+?_*n*2,g[e,?/],l[0..-2],l[-1].sub(/ +(?=\/)/,?_*n*2)]}
```
[Try it online!](https://tio.run/##PcrRCoMgFIDh@z1FdKV5PE5hl@aDmIxVFkGTsDUY1bO7xcbuvh/@uNSv1OnESxKg17xsoF2JRAwU77dp3YYtz/KCBD5Q1rLD6lNs4JKyZt9h1L01Arw2VeUw@qePs6erPc7AzLUIhYLeejDCwWjPiFwd4NLhvNREZIwYXQkq4DtTt6dpecxZZ6U7/aT@urj0Bg "Ruby – Try It Online")
If an upper underscore is allowed, then it would take a bit lesser bytes, while the hexagon is as pretty as it was earlier ;-)
# [Ruby](https://www.ruby-lang.org/), 114 bytes
```
->n{[" "*n+?_*2*n,(g=->c,d{(1..n).map{|i|" "*(n-i)+c+" "*2*(n+i-1)+d}})[?/,e=?\\],g[e,?/].reverse," "*n+?‾*n*2]}
```
[Try it online!](https://tio.run/##KypNqvyfZvtf1y6vOlpJQUkrT9s@XstIK09HI91W1y5ZJ6Vaw1BPL09TLzexoLomswakRiNPN1NTO1kbxDYC8rQzdQ01tVNqazWj7fV1Um3tY2JiddKjU3Xs9WP1ilLLUouKU3Wghj9q2KeVp2UUW/u/oLSkWCEt2jCWC8oygrNMY/8DAA "Ruby – Try It Online")
[Answer]
# [05AB1E](https://github.com/Adriandmen/05AB1E), 70 bytes
```
ð×©'_¹·×«©¶«©¹'/1Λ¹·Ì'.2Λ¹'\3.Λ«©„./`.;©¶¡Â‚€»`s'.ð:,¹3*>(£„._`:„/\Â‡,
```
[Try it online!](https://tio.run/##yy9OTMpM/f//8IbD0w@tVI8/tPPQdiBr9aGVh7aByZ3q@obnZoOFe9T1jEBM9RhjPSANlH3UME9PP0HPGqx64eGmRw2zHjWtObQ7oVhd7/AGK51DO4217DQOLQapi0@wAlL6MSBVC3X@/zcFAA "05AB1E – Try It Online")
[Answer]
# [Perl 5](https://www.perl.org/), 143 bytes
```
sub f{$n=pop;@b=map{join'',$"x($n-$_),'/','  'x($n+$_-1),'\\',$/}1..$n;join('',$"x$n,$u=__ x$n,$/,@b,map y|/\\|\\/|r,reverse@b)=~s| +/$|$u/|sr}
```
[Try it online!](https://tio.run/##bZBNasMwEIX3OsUQBmQTJcIt2cRR8QW66y4qoga5pDSykeKSEKdXd/UT2jqtNpr53nuSRp2276uxdxqetDus14@t1XDwpRMP9yXZn6AKncjItmCbDaXPjIBShANIIpXihGzvvgWveA28GOS4RV8qOAEZDCGz@slAiqUV@2swhad9IhMQ0Q35df0Uyr8wPOsfdgsDmrJI0khp@cECyUvStDaLH5efI9qfMtyZjqE@drmoUJVXDPjaHkQT1TzBncsCjF42C8SIIEsT8My7LqPra2jOaETXdmVVi/1Ld35rd4ZShrNjhmaBKmeUU0YBaABzVIvCIym9hV@K5RJNGSJZyqBh2AulIFacVTXzh8Jp4FIOUvLBMqs/tHW6qnPx6QaYcxyw54Ozl3EsvgA "Perl 5 – Try It Online")
```
sub f{
  $n=pop;             #n = input
  @b=map{             #set array @b to line 2 - n+1
    join'',           #join parts into a line string
    $" x ($n-$_),     #space times n-1
    '/',              #char /
    '  ' x ($n+$_-1), #space times n+iterator minus 1
    '\\',             #char \
    $/                #char newline
  } 1..$n;            #n lines
  join('',            #return string of these joined:
    $" x $n,          #n spaces
    $u = __ x$n,      #n*2 underscores
    $/,               #char newline
    @b,               #lines 2 to n+1 constructed above
    map y|/\\|\\/|r,  #and bottom part which is the same
      reverse@b       #as top part reversed and /\ rotated
  )=~s| +/$|$u/|sr    #and change last spaces of last line to _'s
}
```
[Answer]
# [Haskell](https://www.haskell.org/), 186 168 bytes
-18 bytes with xnor's fixes and removing unneeded spaces on the last line
```
s=' '
(!)=replicate
e=reverse
h n=unlines$(\m->(n!s++(2*n)!'_'++n!s):e(e<$>m)++init m++[(n-1)!s++'\\':(2*n)!'_'++"/"])$(\i->i!s++'\\':(4*n-2*i-2)!s++'/':i!s)<$>[0..n-1]
```
[Try it online!](https://tio.run/##TY7RCoJAEEXf9yvGCHbXZU2lXiT9EY1YbMAhdwjXor@3tYJ6O8O99zCDC1ccx2UJtQQpVKLrCW8j9W5GgZEfOAUUA3B955EYw1Z13jaKk2CMKlPWiTxLY@KtK1R43DZeG0NMM3hjWsW20GtXdp2s/gab3eako4xsQ798n7ItU7LlZ7OTVQx1lLZ5lkXVaRnwCTUMwjviCMQzTq6fQX3/gwy8u8Fa@9CE7hLxHeqlEKU4iCJ/AQ "Haskell – Try It Online")
Ungolfed:
```
hex :: Int -> String
hex n = unlines $ first: middle ++ (init $ reverse (map reverse middle)) ++ [last]
  where
    first = replicate n ' ' ++ replicate (2*n) '_' ++ replicate n ' '
    f i = replicate i ' ' ++ "/" ++ replicate (n-i + 2*n + n-i -2) ' ' ++ "\\" ++ replicate i ' '
    middle = map f [n-1,n-2..0]
    last = replicate (n-1) ' ' ++ "\\" ++ replicate (2*n) '_' ++ "/" ++ replicate (n-2) ' '
```
[Answer]
# [Vyxal](https://github.com/Lyxal/Vyxal), 60 bytes
```
ð*\_?*d+,(n-‹ð*\/n?+ð*d++\\+,)(nð*\\?d‹n-n›?=[\_|ð]*d++\/+,)
```
[Try it Online!](http://lyxal.pythonanywhere.com?flags=&code=%C3%B0*%5C_%3F*d%2B%2C%28n-%E2%80%B9%C3%B0*%5C%2Fn%3F%2B%C3%B0*d%2B%2B%5C%5C%2B%2C%29%28n%C3%B0*%5C%5C%3Fd%E2%80%B9n-n%E2%80%BA%3F%3D%5B%5C_%7C%C3%B0%5D*d%2B%2B%5C%2F%2B%2C%29&inputs=3&header=&footer=)
[Answer]
# [JavaScript (Node.js)](https://nodejs.org), 177 bytes
```
n=>[...Array((N=2*n)+1)].map((_,i,a,g=i>n,s=g?i-n-1:n-i,j=i&&N-i,r='_'.repeat(N),S=Z=>' '.repeat(Z))=>i?S(s)+'/\\'[+g]+(j?'':r)+S(g?j&&6*n-2*i:N+2*--i)+'\\/'[+g]:S(n)+r).join`
`
```
[Try it online!](https://tio.run/##PY67asNAEAB7f4Ur3a7uYSRwCsFK5AfUqLNl7MORjz2cPXEygXy9LFKkG4YpJvofv9wzzy8r6WtaH7QKtWfn3GfO/hegp7oU1BVe3LefAa6GjTeBuBWzUOjYiq0asWwicVH0G2RSV@XyNE/@BT2agU7Uqv2/OiFSy90AC2p1GEd11uGiIXZKNRn1AKGLRfFRiq1Lbnpdl9bylo7j4S9tBtiOMrqYWG6723pPsqTn5J4pwAOqI@L6Bg "JavaScript (Node.js) – Try It Online")
Not the shortest but uses a different approach. Second in my series of text-writing programs which aren't the shortest, but help assemble a repertoire of array solutions.
]