Alternating Triangles

Husk, 12 bytes

↔↑ṁe"|"¡Θ" /

Try it online!

Builds the infinite triangle upside-down, then takes the required number of lines and reverses them before printing.

Explanation

↔↑ṁe"|"¡Θ" /
       ¡        Repeat and accumulate results:
        Θ          prepend a space
         " /       starting from the string " /"
                   (this will create all the lines of the slanted side)
  ṁ             For each line:
   e"|"            put it in a list with a "|" line
  ṁ             and merge all these lists together
 ↑              Take the number of lines required by the input
↔               Reverse the result

Python 2, 45 bytes

def f(n):print n%2*'|'or n/2%n*' '+'/';f(n-1)

Try it online!

A function that prints, terminating with error. The %n in n/2%n is just to give an error when n falls to 0, but is harmless otherwise.


As a program

50 bytes

n=input()
while n:print n%2*'|'or n/2*' '+'/';n-=1

Try it online!


Haskell, 48 bytes

unlines.reverse.(`take`f" /")
f c="|":c:f(' ':c)

Try it online!

f" /" generates an infinite (reversed) approximate triangle, the first line is mostly formatting.