Skip to main content
added 59 characters in body
Source Link
JDL
  • 1.7k
  • 13
  • 18

R, 4747 46 bytes

n=scan();cat(rep(ifc(n%%2)"\\","/"else"\\"")[n%%2+1],n),sep="")

In R, you have to escape backslashes. the argument sep also has to be fully specified since it comes after .... Thus annoyingly few opportunities to save chars :(

Thanks to bouncyball for golfing away a byte.

R, 47 bytes

n=scan();cat(rep(if(n%%2)"/"else"\\",n),sep="")

In R, you have to escape backslashes. the argument sep also has to be fully specified since it comes after .... Thus annoyingly few opportunities to save chars :(

R, 47 46 bytes

n=scan();cat(rep(c("\\","/")[n%%2+1],n),sep="")

In R, you have to escape backslashes. the argument sep also has to be fully specified since it comes after .... Thus annoyingly few opportunities to save chars :(

Thanks to bouncyball for golfing away a byte.

Source Link
JDL
  • 1.7k
  • 13
  • 18

R, 47 bytes

n=scan();cat(rep(if(n%%2)"/"else"\\",n),sep="")

In R, you have to escape backslashes. the argument sep also has to be fully specified since it comes after .... Thus annoyingly few opportunities to save chars :(