[Question]
  [
Suppose an infinite tiling of hexagons composed of `|/\` characters.
```
 / \ / \ / \ / \
|   |   |   |   |
 \ / \ / \ / \ /  etc.
  |   |   |   |
   \ / \ / \ /
```
Given input `n > 0`, output a triangular portion of that tiling as depicted in the below examples, anchored with a `_` in the middle of a hexagon:
```
n=1
\_/
n=2
\/ \/
 \_/
n=3
\  |  /
 \/ \/
  \_/
n=4
\/ \ / \/
 \  |  /
  \/ \/
   \_/
n=5
\  |   |  /
 \/ \ / \/
  \  |  /
   \/ \/
    \_/
n=6
\/ \ / \ / \/
 \  |   |  /
  \/ \ / \/
   \  |  /
    \/ \/
     \_/
n=7
\  |   |   |  /
 \/ \ / \ / \/
  \  |   |  /
   \/ \ / \/
    \  |  /
     \/ \/
      \_/
n=8
\/ \ / \ / \ / \/
 \  |   |   |  /
  \/ \ / \ / \/
   \  |   |  /
    \/ \ / \/
     \  |  /
      \/ \/
       \_/
and so on
```
### Rules
* Leading/trailing newlines or other whitespace are optional, provided that the characters line up appropriately.
* Either a full program or a function are acceptable. If a function, you can return the output rather than printing it.
* Output can be to the console, saved as an image, returned as a list of strings, etc.
* [Standard loopholes](http://meta.codegolf.stackexchange.com/q/1061/42963) are forbidden.
* This is [code-golf](/questions/tagged/code-golf "show questions tagged 'code-golf'") so all usual golfing rules apply, and the shortest code (in bytes) wins.
  
[Answer]
# [Python 2](https://docs.python.org/2/), 86 bytes
```
i=k=input()
while i:i-=1;print(" "*(k+~i)+"\\"+i*' /  |\  '[i%2::2])[:k-~i]+"_/"[i>0:]
```
[Try it online!](https://tio.run/##BcFNCsIwEAbQfU8xDEjzQ6lmVUbSiyTBldCPSAwlIkLp1eN79de2d3G9w2ePUj9N6eG74fUkCCZ/u9cdpSkmNirbE9pyjGxhRpqJjkg0BlyciEs6SJ5OJMuPmQPWq6Telz8 "Python 2 – Try It Online")
One of Erik’s tricks allowed me to golf 3 bytes! Saved 3 bytes thanks to Jonathan Allan.
## How this works
First off, this gets input from STDIN and assigns it to two separate variables `i` and `k`. Then, while the variable `i` is truthy, we decrement it and generate the strings accordingly; this is a shorthand for looping from the input - 1 all the way down to 0.
### Generating the Strings
I'll split this into more parts:
* First off, getting the leading spacing is achieved with `" "*(k+~i)`. Since `i` is mapped through the range **(input, 0]**, we must subtract it from `k` (our safely stored original input), decrement and repeat a space that many times.
* `+"\\"` - Adds the character `"\"` to the spaces above.
* `' / |\ '[i%2::2]` - Generates our two strings, namely `"/ \ "` and `" | "`, in the following manner:
	+ If `i` is odd, **i % 2** is **1**, thus `[i%2::2]` returns each 2 characters of our larger string, starting at index **1** (0-indexed).
	+ If `i` is even, **i % 2** is **1**, thus the mechanism above does the same except it starts at index **0**.
* `+~-i*` - Repeats the string generated above, either `"/ \ "` or `" | "`, **i-1** times, and appends it to the other strings. The benefit of the bitwise operator (`~` - Bitwise Complement, Equivalent to **i** subtracted from **-1**) is that it doesn't require parenthesis in this context.
* `[:k-~i]` - Gets all the characters of the strings concatenated above until index **k-~i = k - (-1 - i) = k + 1 + i**.
* `+"_/"[i>0:]` - This only adds `"/"` if **i ≥ 1**, else it appends `_/`.
## Full example / execution details
Let's grab an example of how things work for an input of **4**:
```
i=k=input()        # i and k are assigned to 4.
while i:           # Starts the loop. The initial value of i is 4.
i-=1;              # Decrement i. i is now 3.
" "*(k+~i)         # A space repeated k - 1 - i = 4 - 1 - 3 = 0 times.
+"\\"              # Plus the character "\". CS (Current string): "\".
' /  |\  '[i%2::2] # The string ' /  |\  '[3%2::2] = ' /  |\  '[1::2] = "/ \ ".
i*                 # ^ repeated i = 3 times: "/ \ / \ / \ ".
+                  # And concatenate. CS: "\/ \ / \ / \ "
[:k-~i]            # Get the characters of ^ up to index k + 1 + i = 4 + 1 + 3 = 8.
                   # CS: "\/ \ / \".
+"_/"[i>0:]        # Append "_/"[i>0:] = "_/"[3>0:] = "_/"[1:] = "/".
                   # CS: "\/ \ / \/".
print              # Output the result "\/ \ / \/".
while i:           # i is truthy (> 0), thus we loop again.
i-=1;              # Decrement i. i becomes 2.
" "*(k+~i)         # " " repeated 4 - 2 - 1 = 1 time. 
+"\\"              # Plus "\". CS: " \".
' /  |\  '[i%2::2] # ' /  |\  '[2%2::2] = ' /  |\  '[::2] = "  | ".
+i*                # Repeat i = 2 times and append: "  | ". CS: " \  |  |".
[:k-~i]            # CS up until k + 1 + i = 4 + 2 + 1 = 7. CS: " \  |  ".
+"_/"[i>0:]        # Append "/". CS: " \  |  /".
print              # Outputs the CS: " \  |  /".
while i:           # i is truthy (> 0), thus we loop again.
i-=1;              # Decrement i. i is now 1.
" "*(k+~i)         # " " repeated 4 - 1 - 1 = 2 times. 
+"\\"              # Plus "\". CS: "  \".
' /  |\  '[i%2::2] # ' /  |\  '[2%2::2] = ' /  |\  '[::2] = "/ \ ".
+i*                # Repeat i = 1 time and append: "/ \ ". CS: "  \/ \ ".
[:k-~i]            # CS up until k + i + 1 = 4 + 2 = 6. CS: "  \/ \".
+"_/"[i>0:]        # Append "/". CS: "  \/ \/".
print              # Outputs the CS: "  \/ \/".
while i:           # i is truthy (> 0), thus we loop again.
i-=1;              # Decrement i. i is now 0.
" "*(k+~i)         # " " repeated 4 - 1 - 0 = 3 times. 
+"\\"              # Plus "\". CS: "   \".
' /  |\  '[i%2::2] # ' /  |\  '[1%2::2] = ' /  |\  '[1::2] = "  | ".
+i*                # Repeat i = 0 times and append: "   \". CS: "   \".
[:k-~i]            # CS up until k + i + 1 = 4 + 0 + 1 = 5. CS: "   \".
+"_/"[i>0:]        # Append "_/" (because i > 0 is False since i == 0). CS: "  \_/".
print              # Outputs the CS: "  \_/".
while i:           # i == 0, hence the condition is falsy and the loop ends. 
                   # Program terminates.
```
[Answer]
# [Python 2](https://docs.python.org/2/), 90 bytes
```
n=N=input()
while N:print' '*(n-N)+'\\'+(('/   \|  '[N%2::2]*n)[:N*2-1],'_')[N<2]+'/';N-=1
```
[Try it online!](https://tio.run/##BcFNCsIwEAbQvaeYjXz5MZTOSqK5wlwgCa6EBmQMkiKCd0/f67@xvZXn1CSpad@Hsafv1l5Pktg/TQcIzmgQ61EKvDFYiKj8iZDlzDFydWpzFMdhrRc8YLPcuXosuElI65zXAw "Python 2 – Try It Online")
[Answer]
# [05AB1E](https://github.com/Adriandmen/05AB1E), 33 bytes
```
1ŸεÐi'_ë"/ \   | "4ôsès∍}'\ì.∞}.c
```
[Try it online!](https://tio.run/##ATcAyP8wNWFiMWX//zHFuM61w5BpJ1/DqyIvIFwgICB8ICI0w7Rzw6hz4oiNfSdcw6wu4oiefS5j//84 "05AB1E – Try It Online")
[Answer]
# Mathematica, 131 bytes
```
Join[Table[s=StringRiffle@Table[If[OddQ@i,"/ \\"," | "],⌈i/2⌉];""<>{"\\",If[!OddQ@i,{" ",s," "},s],"/"},{i,#-1,1,-1}],{"\_/"}]&   
```
  
returns a list of strings 
[Try it online!](https://tio.run/##LY29CsJAEIRfZV3BakOIYKWRtNr4210OOc2dLiQRzHUxvUKeMi9yrmg18M03TGX8zVbG88UEBymE9Z1rdTTn0qomPfgH19c9O1fa7AdXTm2KYpcxYQx5joTwBNQ09C@Op0P/1nPExbLFbyfy6G@3CEiN2NhRo2Us2TKNo4QSipJOi5GfhOpJ2Mqrh8ypmQ4f "Wolfram Language (Mathematica) – Try It Online")
[Answer]
# [Retina](https://github.com/m-ender/retina), ~~129~~ ~~119~~ 112 bytes
```
\d+
$* 
 
¶$`a $'$' 
m`$
/
  /$
_/
^.¶
a(    )*/
a$#1/
\d+
$*
1
/ a  
 (    )*/
$#1/
\d+
$*
1
 |  
a /¶
a/¶
a
\
```
[Try it online!](https://tio.run/##VYy7CYBAEETzqWLAhfMDLhfYjagLGhhoIIbWZQE2di4KghNM8nhvm/Z5tZTasYKUBHGdMhglSCCWQaAgVdAruvo6AcvpK0qFSRYVr4kIpdEDH/5THg6N6gl7Dm1KzQ0 "Retina – Try It Online")
[Answer]
# [Charcoal](https://github.com/somebody1234/Charcoal), 26 bytes
```
ＮθＧ↖→↓θ“ ″✂=ＡＬ«Q"η\`”←_↖θ‖Ｂ
```
[Try it online!](https://tio.run/##S85ILErOT8z5/98zr6C0xK80Nym1SKNQ05orID@nMj0/T8MqtMAnNa1ER8EqKDM9A0S75Jfn6SgU6igoKSjUxOQp6CvExMTkgVgxMQr6SiC9RZl5JRpWEH1K8UhCMMNANgSlpuWkJpc4lZaUpBal5VRqaFr//2/xX7csBwA "Charcoal – Try It Online") Link is to verbose version of code.
[Answer]
# [Python 2](https://docs.python.org/2/), ~~123~~ ~~112~~ ~~110~~ ~~109~~ ~~100~~ ~~98~~ 96 bytes
```
i=n=input()
while i:a=i%2;print' '*(n-i)+'\%s/'%['_',((-~i/2)*'/   \  |'[a::2])[a:~a]][i>1];i-=1
```
[Try it online!](https://tio.run/##DcVBCsIwEAXQvaeYTZikNYRmJSnxImmQLIR@kDHYiBSkV4@@zat7W5/ie0eUCKnvps3ps@JxJ4QSofxcX5DGxIMWCzPyojbHKvGNz1rbA86bgR0RLURfTiUEn82/o@SccJ3yDBun3i8/ "Python 2 – Try It Online")
* Saved a bunch of bytes by using input and string formatting as in [Rod's answer](https://codegolf.stackexchange.com/a/146648/38592)
* Saved 2 bytes thanks to Mr. Xcoder
[Answer]
# [Python 2](https://docs.python.org/2/), 103 bytes
```
i=n=input()
while i:print' '*(n-i)+'\%s/'%' '.join(['/\\'*(-~i/2),['_',' '+'| '*(i/2)][i>1]][i%2]);i-=1
```
[Try it online!](https://tio.run/##K6gsycjPM/r/P9M2zzYzr6C0REOTqzwjMydVIdOqoCgzr0RdQV1LI083U1NbPUa1WF9dFSigl5WfmacRra4fEwOU1K3L1DfS1IlWj1fXAUpqq9eAtIDEYqMz7QxjgaSqUaymdaaureH//xYA "Python 2 – Try It Online")
[Answer]
# [APL (Dyalog)](https://www.dyalog.com/), ~~97~~ 93 bytes
```
{⍵=1:1 3⍴'\_/'⋄x←' ',' ',⍨∇⍵-1⋄y←1+2×⍵-1⋄2|⍵:x⍪⍨'\','/',⍨y⍴'  | '⋄x⍪⍨'\/','\/',⍨(y-2)⍴' \ /'}
```
[Try it online!](https://tio.run/##SyzI0U2pTMzJT///P@1R24TqR71bbQ2tDBWMH/VuUY@J11d/1N1SAZRQV1DXAeFHvSsedbQDVekaAmUqgTKG2kaHp8MEjGqALKuKR72rgArVY4B69MF6KkHGKSjUKEDMg0oD5cAEkKNRqWukCVYUo6CvXgt0zaEVj3o3WwAA "APL (Dyalog Unicode) – Try It Online")
[Answer]
# [SOGL V0.12](https://github.com/dzaima/SOGL), ~~28~~ 27 [bytes](https://github.com/dzaima/SOGL/blob/master/chartable.md)
```
╔.H∫"C↕‽«‘4nwιF«Im}¹⌡¾\/¹№╚
```
[Try it Here!](https://dzaima.github.io/SOGLOnline/?code=JXUyNTU0LkgldTIyMkIlMjJDJXUyMTk1JXUyMDNEJUFCJXUyMDE4NG53JXUwM0I5RiVBQkltJTdEJUI5JXUyMzIxJUJFJTVDLyVCOSV1MjExNiV1MjU1QQ__,inputs=NQ__)
[Answer]
# [Haskell](https://www.haskell.org/), ~~96~~ 95 bytes
```
f n=[([1..n-x]>>" ")++'\\':take(2*x+1)(cycle$("_":a)!!x)++"/"|x<-[n,n-1..0]]
a="/ \\ ":"  | ":a
```
[Try it online!](https://tio.run/##DYtBCoMwEADvfcW6CCZN1dpLITR@osdESpCIYrqUGiEF/57mNHOYme22Ou9TmoCUZrprGqrj0PcIyIWojKlksKtjt3MUHWfjb/SuZPhCaXlRxNxgi0d81JouVOf9Ogwnq7AFYwAlAhwZNr3tQqDgs4dn@EIJO/mF3JZtgnv6Aw "Haskell – Try It Online")
0-indexed and returns a list of lines.
[Answer]
## Haskell, ~~101~~ 99 bytes
```
j 1=["\\_/"]
j n|r<-([1,3..n-1]>>)=('\\':cycle[init$r"/ \\ ",' ':r" |  "]!!n++"/"):map(' ':)(j$n-1)
```
Returns a list of lines.
[Try it online!](https://tio.run/##FY1LCoMwGAb3PcXnj5AEX4TuQuMJ2lWXiYiI0GgMktpFwbundjsDM6/hvUzepzRDakPW9g11lxnhiLeKG1le6zpUsmtboTmzlqnxO/rJuOD2PFIDa0ElA1ORcADUZVkoCmpIqHXY@N8IPudnQ6R1cAEaJ3/02D77c4/3gBznW6Yf "Haskell – Try It Online")
How it works:
```
j 1=["\\_/"]               -- base case, n=1
j n                        -- for all other n
   |r<-([1,3..n-1]>>)      -- let r be the function that makes n/2 copies of
                           -- it's argument
   =                       -- the result is
      '\\':                --  a backslash, followed by
      cycle[  ]!!n         --  the inner part, which is
          init$r"/ \\ "    --    all but the last char of some copies of
                           --    "/ \ " for even line numbers, or
          ' ':r" |  "      --    some copies of " |  " prepended by a space
                           --    for odd line numbers
                           --    (chosen by indexing an infinite list of
                           --     both values alternating)   
      ++"/"                --  followed by a slash
    :                      --  and append a
               j$n-1        --  recursive call with n-1
      map(' ':)            --  where each line is prepended by a space
```
Edit: @Laikoni saved two bytes. Thanks!
[Answer]
# [Java (OpenJDK 8)](http://openjdk.java.net/), ~~315~~ 306 bytes
```
i->{String r="";int j=0,k,u=i*2;char[][]c=new char[i][u+1];c[i-1][i]=95;for(;j<i;r+="".valueOf(c[j++]).replace('\0',' ')+"\n")for(k=0;k<u+1;k++){if(k==j)c[j][k]=92;if(k==u-j)c[j][k]=47;if(k>j&k<u-j)if((i-j)%2<1)c[j][k]=(k-j-1)%2<1?(char)(47+((k-j-1)/2)%2*45):32;else if((k-j-1)%4==2)c[j][k]='|';}return r;}
```
[Try it online!](https://tio.run/##RZHNbsIwEITPzVNYSG1s8lMSQKh1TG@Veqh64BhycIMBJ8GJHJsKUZ493UBEfbH2251Za1zwIw/qRqhiU3by0NTaoAJYaI2swq1VuZG1CsfUcRr7Xckc5RVvW/TJpUJn56E13AB8HwaTD2XETmgfrYyWardEe3kUiKFOBsvzjSHNRiMqFSxiE7/0LZPjmOZ7rtMszXKmxA@6VjJLrRdlNE9lEGVQspc53dYa0yKRVHtgEx55ZcXXFudp4XkZCbVoKp4L7K4nru8il3ijtRqRXlWyCS0TcKSl55Gz3AJhBQFllpbgHdMbssE/nC2ucFk8gRI4FFjC/Rgn0X0Il0ERRFf2hvuXEzxbeHjAzzF0xrM5eZ3GVFStQL3JIJkxFt993F@XXrQwViuk6aWjQ@JDxsdabtABcse3HNMMcQJ/gIazOrVGHMLamrCBvsF99CFvmuqEoykh9Dp5cS7dHw "Java (OpenJDK 8) – Try It Online")
[Answer]
# [Java (OpenJDK 8)](http://openjdk.java.net/), 198 bytes
Finally got it below 200 bytes. Will probably post an explanation later.
```
i->{for(int k=i+1;i>0;System.out.println(("".format("%"+(k-i)+"s","")+"\\"+(i<2?"":"".format("%"+(i-1)+"s","")).replace(" ","/ \\ ,  | ".split(",")[i%2])).substring(0,i<2?k:k+i)+(--i<1?"_/":"/")));}
```
[Try it online!](https://tio.run/##XY@9bsJAEITr81OsVkI6y/ZhU1BgfuoUoaG0UXTAgRabs@U7kCLiZ3cWK0mRarWjmW80V/3QSdMaez1Vw7HWzsG7JvsMBFlvurM@Gtg@AxDi0dAJLpJloDAPRB8Eor0fajqC89rzGR03Tsud78heij3okElizMAK3hh5MZ1qdecMP1IX6f7FElYx@Zf6g9uC5cxAyfp5brqxuFpRlOW0TvPdp/Pmppq7Vy13@dpKiajYeNNe4gQjWSUURugwRuRblizRcrZBXPwzUpL9GUPVmbbm1RKBhSmUJcQAX4DKtTVxIsawoMlsz1Z3P7hxqUzjF7paVBF3yiShZbbBjylXTZkZ5v0g8qAfhvk3 "Java (OpenJDK 8) – Try It Online")
[Answer]
# JavaScript (ES6), ~~89~~ 85 bytes
```
f=(y,s='\\')=>--y?s+(y&1?' / \\':' |  ').repeat(y).slice(~y-y)+`/
`+f(y,' '+s):s+'_/'
```
### Demo
```
f=(y,s='\\')=>--y?s+(y&1?' / \\':' |  ').repeat(y).slice(~y-y)+`/
`+f(y,' '+s):s+'_/'
console.log(f(1))
console.log(f(2))
console.log(f(3))
console.log(f(4))
console.log(f(5))
console.log(f(6))
console.log(f(7))
```
[Answer]
# CJam, 43
```
ri_{S*'\@(:X"  | / \ "4/=X*X2*)<'_e|'/NX}/;
```
[Try it online](http://cjam.aditsu.net/#code=ri_%7BS*%27%5C%40(%3AX%22%20%20%7C%20%2F%20%5C%20%224%2F%3DX*X2*)%3C%27_e%7C%27%2FNX%7D%2F%3B&input=8)
[Answer]
# PHP, 89+1 bytes
```
while($k=$argn-$n)echo($p=str_pad)("",$n++),$p("\\",2*$k,$k>1?$k&1?"  | ":"/ \ ":_),"/
";
```
Run as pipe with `-nR` or [try it online](http://sandbox.onlinephpfunctions.com/code/71e3795a77c65c4d95c80c96c093e86d2da2db07).
[Answer]
# [Pyth](https://github.com/isaacg1/pyth), ~~46~~ 44 bytes
```
j_m+<++*;t-Qd\\*d%2>" /  |\  "%d2h+Qd>"_/"._
```
**[Try it here!](https://pyth.herokuapp.com/?code=j_m%2B%3C%2B%2B%2a%3Bt-Qd%5C%5C%2ad%252%3E%22+%2F++%7C%5C++%22%25d2h%2BQd%3E%22_%2F%22._&test_suite=1&test_suite_input=1%0A2%0A5%0A6&debug=0)**
]