[Question]
  [
Your task: make a hexagonal triangle with side length `n`, where `n` is a positive whole number or 0.
First, let me define a hexagon:
```
 / \
|   |
 \ /
```
(Amazing ASCII art, right?)
Hexagons can be linked together by sharing sides:
```
 / \ / \
|   |   |
 \ / \ /
   / \  
  |   |
 / \ /
|   |
 \ /
```
A hexagonal triangle is the following:
```
   / \
  |   |
 / \ / \
|   |   |
 \ / \ /
```
That hexagonal triangle has a side length of 2-- 2 hexagons are required to make one side. A hexagonal triangle with side-length 1 is just a single hexagon, and a hexagon with side-length 0 is empty.
More formally, a hexagonal triangle is a triangle made of hexagons linked by their sides. The top hexagon links to the two below it on its bottom two sides. The triangle in the bottom left links to the one to its right and top-right, and the one in the bottom right links to the ones on its left and upper left. There are hexagons *in between* the corner ones, connected by their opposite sides, and their number is `n-2`. The triangles are **not** filled.
More examples:
```
Side length 3:
     / \
    |   |
   / \ / \
  |   |   |
 / \ / \ / \
|   |   |   |
 \ / \ / \ /
Side length 4:
       / \
      |   |
     / \ / \
    |   |   |
   / \ / \ / \
  |   |   |   |
 / \ / \ / \ / \
|   |   |   |   |
 \ / \ / \ / \ /
(This triangle isn't really filled, the borders make it look like there is a hexagon in the middle, but there is not.)
Side length 5:
         / \
        |   |
       / \ / \
      |   |   |
     / \ / \ / \
    |   |   |   |
   / \ /     \ / \
  |   |       |   |
 / \ / \ / \ / \ / \
|   |   |   |   |   |
 \ / \ / \ / \ / \ /
Side length 6:
           / \
          |   |
         / \ / \
        |   |   |
       / \ / \ / \
      |   |   |   |
     / \ /     \ / \
    |   |       |   |
   / \ /         \ / \
  |   |           |   |
 / \ / \ / \ / \ / \ / \
|   |   |   |   |   |   |
 \ / \ / \ / \ / \ / \ /
```
  
[Answer]
# [Charcoal](https://github.com/somebody1234/Charcoal), ~~62~~ ~~43~~ 39 bytes
```
ＮβＦ³«Ｆ⁻β‹ι²« / \¶|   |¶ \ /Ｍ×²ι↑¿⁻¹ιＭ⁶←
```
[Try it online!](https://tio.run/##S85ILErOT8z5///9nnXnNr3fs@zQ5kOrgdSjxt3nNj1q2Hlu56FNh1Yr6CvEHNpWo6CgUHNom0KMgv77PWsPTz@06dzOR20TD@0HKj4EVAkUfNS47VHbhP//TQE "Charcoal – Try It Online") Edit: Saved some bytes thanks to @ASCII-only (not sure exactly how many as I also saved another ~~6~~ 10 bytes but then needed to spend 4 bytes on a bugfix). Now using nested loops, which is what this should have been all along.
[Answer]
# Python 2, ~~184~~ ~~177~~ ~~174~~ 164 bytes
```
n=input();p='|   |';e=' \\ /'
for i in range(n):k=' '*(4*i-5);w='  '*~(i-n);print w+[' / \\'*-~i+'\n'+w+p[:4]*i+p,' /'+e+k[3:]+e+' \\\n'+w+p+k+p][2<i<n-1]
print e*n
```
[Try it Online!](https://tio.run/nexus/python2#LY07DsIwEET7nGK7tb1YIRCafE5iu6AwaBVpsaKgNFGuHhZBNXqa0ZtDRpbyXozty4gbAGzY5xEhRqixerxmYGCB@S7PbMR2k3boTOvY32y/Kinuhr2oYWZZYKWAUKsAnd@ZMArSSiV0bXJM5aQlUqYpXLuk@b36T2iiksJl4EF8k6qfLjs5jub8AQ)
*-7 bytes thanks to Ørjan Johansen*
[Answer]
## JavaScript (ES6), 243 bytes
```
f=n=>(n=n*2-2,a=[...Array(n+3)].map(_=>Array(n*2+5).fill` `),g=(y,x)=>(a[y+1][x]=a[y+1][x+4]=`|`,a[y][x+1]=a[y+2][x+3]=`/`,a[y][x+3]=a[y+2][x+1]=`\\`),[...Array(n+!n)].map((_,i)=>i%2||(g(n,i*2),g(i,i=n-i),g(i,n+i))),a.map(a=>a.join``).join`
`)
```
```
<input type=number oninput=o.textContent=f(this.value)><pre id=o>
```
[Answer]
## JavaScript (ES6), ~~133~~ ~~129~~ ~~128~~ 126 bytes
Builds the output character by character with two *for* loops.
```
n=>{for(s='',y=n*2,n*=4;~y--;s+=`
`)for(x=n;~x--;)s+=' \\ /|'[x>y-2&x<n-y&(k=x+y&3,x>n-y-6|x<y+4|y<2)?y&1?k:k+1&4:0];return s}
```
### How it works
In the outer loop, ***y*** iterates from ***n\*2-1*** to ***-1***. In the inner loop, ***x*** iterates from ***n\*4-1*** to ***-1***. We set ***k = (x+y) & 3***, which is the underlying pattern that is used to generate the hexagons.
Below is the resulting grid for ***n = 4***:
```
     15 14 13 12 11 10  9  8  7  6  5  4  3  2  1  0 -1
   +---------------------------------------------------
 7 |  2  1  0  3  2  1  0  3  2  1  0  3  2  1  0  3  2
 6 |  1  0  3  2  1  0  3  2  1  0  3  2  1  0  3  2  1
 5 |  0  3  2  1  0  3  2  1  0  3  2  1  0  3  2  1  0
 4 |  3  2  1  0  3  2  1  0  3  2  1  0  3  2  1  0  3
 3 |  2  1  0  3  2  1  0  3  2  1  0  3  2  1  0  3  2
 2 |  1  0  3  2  1  0  3  2  1  0  3  2  1  0  3  2  1
 1 |  0  3  2  1  0  3  2  1  0  3  2  1  0  3  2  1  0
 0 |  3  2  1  0  3  2  1  0  3  2  1  0  3  2  1  0  3
-1 |  2  1  0  3  2  1  0  3  2  1  0  3  2  1  0  3  2
```
On even rows, a cell is filled with a pipe character when ***k = 3***, and a space otherwise. The pipe is the 5th character in our reference string `" \ /|"`, so the correct index is given by ***(k+1) & 4***.
On odd rows, each cell is filled directly with the corresponding character in the reference string:
* ***k = 0*** → space
* ***k = 1*** → "\"
* ***k = 2*** → space
* ***k = 3*** → "/"
Below is our updated example (spaces replaced with dots):
```
     15 14 13 12 11 10  9  8  7  6  5  4  3  2  1  0 -1
   +---------------------------------------------------
 7 |  .  \  .  /  .  \  .  /  .  \  .  /  .  \  .  /  .
 6 |  .  .  |  .  .  .  |  .  .  .  |  .  .  .  |  .  .
 5 |  .  /  .  \  .  /  .  \  .  /  .  \  .  /  .  \  .
 4 |  |  .  .  .  |  .  .  .  |  .  .  .  |  .  .  .  |
 3 |  .  \  .  /  .  \  .  /  .  \  .  /  .  \  .  /  .
 2 |  .  .  |  .  .  .  |  .  .  .  |  .  .  .  |  .  .
 1 |  .  /  .  \  .  /  .  \  .  /  .  \  .  /  .  \  .
 0 |  |  .  .  .  |  .  .  .  |  .  .  .  |  .  .  .  |
-1 |  .  \  .  /  .  \  .  /  .  \  .  /  .  \  .  /  .
```
In the following formulas, we define ***N = n\*4*** for readability (although the same variable is used in the code).
The triangle shape is obtained by testing:
* ***x > y - 2*** → removes the right corner
* AND ***x < N - y*** → removes the left corner
And the inner part is removed by testing:
* ***x > N - y - 6*** → keeps only the left edge
* OR ***x < y + 4*** → keeps only the right edge
* OR ***y < 2*** → keeps only the bottom edge
### Demo
```
let f =
n=>{for(s='',y=n*2,n*=4;~y--;s+=`
`)for(x=n;~x--;)s+=' \\ /|'[x>y-2&x<n-y&(k=x+y&3,x>n-y-6|x<y+4|y<2)?y&1?k:k+1&4:0];return s}
console.log(f(3))
console.log(f(4))
console.log(f(5))
console.log(f(6))
console.log(f(7))
```
[Answer]
# [Jelly](https://github.com/DennisMitchell/jelly), ~~62~~ 61 [bytes](https://github.com/DennisMitchell/jelly/wiki/Code-page)
### *Currently containing six sixes.*
```
_‘<×⁸>6
Rµ‘⁾| ẋ⁾/\ẋ⁸¤ż;/K€µ⁶ðMṀ_6r6ẋð¦"Jç¥
ḤḶUẋ@€⁶;"Çµ-ịṙ6ṭ⁸Y
```
**[Try it online!](https://tio.run/nexus/jelly#@x//qGGGzeHpjxp32JlxBR3aCuQ@atxXo/BwVzeQ1o8B0zsOLTm6x1rf@1HTGqCKxm2HN/g@3NkQb1ZkBpQ@vOHQMiWvw8sPLeV6uGPJwx3bQoGCDkClQIXWSofbD23Vfbi7@@HOmWYPd64FmhX5//9/MwA)**
### How?
```
_‘<×⁸>6 - Link 1, should we eat the praline? row number, triangle size
_       - row number minus triangle size
 ‘      - plus one
  <     - less than triangle size? (1 if one of the last rows else 0)
   ×⁸   - multiply by row number   (row number or 0)
     >6 - greater than 6?          (row number if between row 6 and last two rows)
Rµ‘⁾| ẋ⁾/\ẋ⁸¤ż;/K€µ⁶ðMṀ_6r6ẋð¦"Jç¥ - Link 2, build a solid triangle: triangle size
                                              (except the very bottom row)
R                                  - range: [1,2,...,size]
 µ                                 - monadic chain separation, call that r
  ‘                                - increment: [2,3,...,size+1]
   ⁾| <space                       - literal "| "
      ẋ                            - repeat: ["| | ","| | | ",...]
            ¤                      - nilad followed by link(s) as a nilad:
       ⁾/\                         -   literal "/\"
           ⁸                       -   link's left argument, r
          ẋ                        -   repeat (vectorises): ["/\","/\/\",...]
             ż                     - zip the two repeated lists together: [["/\","| | "],["/\/\","| | | "],...]
              ;/                   - reduce by concatenation: ["/\","| | ","/\/\","| | | ",...]
                K€                 - join with spaces for €ach: ["/ \","|   |  ","/ \ / \","|   |   |  ",...]
                  µ                - monadic chain separation call that s
                                 ¥ - last two links a a dyad:
                               J   -   range(length(s))  
                                ç  -   call the last (1) link as a dyad (left = result of J, right = size)
                              "    - zip with: (call those d)
                    ð       ð¦     -   apply to indexes:
                   ⁶               -   a literal space character
                     M             -     indexes of maximal elements in an element of s (a row)
                      Ṁ            -     maximum (this is the rightmost non-space index, MṀ working like length ignoring trailing spaces)
                       _6          -     subtract 6  (6 indexes back from the right)
                         r6        -     range from there to 6, i.e [l-6,l-7,...,6]
                           ẋ       -     repeat d times (1 or 0), thus applying to the middle rows but not the bottom and top ones.
ḤḶUẋ@€⁶;"Çµ-ịṙ6ṭ⁸Y - Main link: triangle size
Ḥ                  - double(size)
 Ḷ                 - unlength: [0,1,2,...,double(size)-1]
  U                - upend: [double(size)-1,...,2,1,0]
      ⁶            - literal space character
   ẋ@€             - repeat for €ach with reversed arguments ["  ...  ",...,"  "," ",""]
         Ç         - call the last link (2) as a monad(size)
       ;"          - zip with concatenation (zips the leading spaces with the solid triangle body)
          µ        - monadic chain separation, call that t
           -ị      - index -1 (last but one row of t)
             ṙ6    - rotate left by 6 (any number congruent to 2 mod 4 would do)
               ṭ⁸  - tack to t (add this new row on)
                 Y - join all the rows by new lines
                   - implicit print
```
[Answer]
# [Pyth](https://github.com/isaacg1/pyth), 82 bytes
```
jb+Rt_.rd"/\\"_.e<s[dd*dkb*dyQ)hyQ*,"|   |""/ \\ /"tQ*Q" / \\"+*Q"|   "\|*Q" \\ /"
```
[Try it online!](http://pyth.herokuapp.com/?code=jb%2BRt_.rd%22%2F%5C%5C%22_.e%3Cs%5Bdd%2adkb%2adyQ%29hyQ%2a%2C%22%7C+++%7C%22%22%2F+%5C%5C+%2F%22tQ%2aQ%22+%2F+%5C%5C%22%2B%2aQ%22%7C+++%22%5C%7C%2aQ%22+%5C%5C+%2F%22&input=6&debug=0)
[Answer]
## Mathematica, 155 bytes
```
""<>Table[If[i+j<d||i-j>d+1||i+j>d+5&&i-j<d-3&&j<d-1," ",Switch[Mod[i+d+{j,-j},4],{1,3},"/",{3,1},"\\",{1,1},"|",_," "]],{j,(d=2#)+1},{i,4#+1}]~Riffle~"\n"&
```
with `\n` replaced with a newline.
More readable:
```
"" <> Table[
    If[i+j < d || i-j > d+1 || 
      i+j > d+5 && i-j < d-3 && j < d-1, " ", 
     Switch[Mod[i+d+{j,-j}, 4], {1, 3}, "/", {3, 1}, 
      "\\", {1, 1}, "|", _, " "]], {j, (d=2#)+1}, {i, 4#+1}]~
   Riffle~"\n" &
```
Creates an array of characters, indexed by *i* from 1 to 4 *n* + 1 horizontally and *j* from 1 to 2 *n* + 1 vertically. First, `Switch[Mod[i+d+{j,-j},4],{1,3},"/",{3,1},"\\",{1,1},"|",_," "]` fills in a hexagonal grid:
```
 \ / \ / \ / \ / 
  |   |   |   |  
 / \ / \ / \ / \ 
|   |   |   |   |
 \ / \ / \ / \ / 
  |   |   |   |  
 / \ / \ / \ / \ 
|   |   |   |   |
 \ / \ / \ / \ / 
```
then `If[i+j<d||i-j>d+1||i+j>d+5&&i-j<d-3&&j<d-1," ",...]` replaces this with `" "` outside the unfilled triangle.
]