Skip to main content
1 of 4
emirps
  • 1.8k
  • 6
  • 15

><> (Fish), 27 bytes

v>&"@"+o
<^v?)"@"&:
-n>&"@"

Try it

Assumes input is on the stack. Exits with error, which is allowed by default

Explanation

A bit messy to explain because the IP goes in several paths.

v
<       &: | store the value in the & register
    )"@"   | is it alphabetic? (if it is greater than 64 (charcode of @)
  v
-n>&"@"    | subtract the & register and 64 and output as a number
           | otherwise the rest of the first line is executed
 >&"@"+o   | adding & register and @ (64) and outputting the char of that charcode
emirps
  • 1.8k
  • 6
  • 15