Skip to main content
added 140 characters in body
Source Link
MarcMush
  • 6.6k
  • 13
  • 17

Julia 1.0, 7373 71 bytes

  
f(s,b=1<0b=0)=[c∈"aA" ? b=!b=32-b : print(c+32isletterc+isletter(c)sign('_'-c)b) for c=s]

Try it online!

Stolen and improved from Simeon Schaub's great answer

Try it online!-2 bytes thanks to Czylabson Asa

Julia 1.0, 73 bytes

 
f(s,b=1<0)=[c∈"aA" ? b=!b : print(c+32isletter(c)sign('_'-c)b) for c=s]

Stolen and improved from Simeon Schaub's great answer

Try it online!

Julia 1.0, 73 71 bytes

 
f(s,b=0)=[c∈"aA" ? b=32-b : print(c+isletter(c)sign('_'-c)b) for c=s]

Try it online!

Stolen and improved from Simeon Schaub's great answer

-2 bytes thanks to Czylabson Asa

Source Link
MarcMush
  • 6.6k
  • 13
  • 17

Julia 1.0, 73 bytes

f(s,b=1<0)=[c∈"aA" ? b=!b : print(c+32isletter(c)sign('_'-c)b) for c=s]

Stolen and improved from Simeon Schaub's great answer

Try it online!