All credits to Adnan for coming up with this challenge.

My last challenge, before I go on break.

Given positive integer n, if n is odd, repeat / that many times; if n is even, repeat \ that many times.

(Seriously, the testcases would be much clearer than this description, so just look at the testcases.)

Testcases

n output
1 /
2 \\
3 ///
4 \\\\
5 /////
6 \\\\\\


Thunno 2, 5 bytes

\/i×


Explanation

\/i×  # Implicit input
\/    # Two character string "\\/"
i   # Modularly index in
×  # Repeat input times
# Implicit output


Regenerate, 22 bytes

(/{1/($~1%2)}|\\){$~1}


Attempt This Online!

Explanation

(/{1/($~1%2)}|\\){$~1}
/                      Match a forward slash
{         }           repeated this many times:
1/(     )             Invert:
$~1 Command-line argument %2 mod 2 (For odd arguments, this gives one forward slash; for even arguments, it fails due to division by zero) | If the previous alternative failed, \\ match a backslash instead ( ){$~1}  Repeat the above (command-line argument) times


Ly, 17 bytes

'\'/n:2%Isp[,lo];


Try it online!

I tried a couple variations and this one was the shortest. It's uses the eveness/oddness of the number to pick the character from a list on the stack, then stashes it away before looping "N" times and printing the saved character. The stack ends up with junk on it so it explicitly exits to avoid printing it. That proved shorter than cleaning the stack.

'\'/               - push "\/" onto the stack
n:             - get number "N" from STDIN and duplicate
2%           - get 0|1 depending on whether it's even or odd
I          - copy top "\" or one-down "/" entry from stack
sp        - stash the char and delete
[,  ]   - loop "N" times
lo    - load char to print, print it
;  - exit to avoid printing junk on the stack
`