Skip to main content
Saved a byte
Source Link

Julia, 1313 12 bytes

f(n)=n==0=n<1?1:n

Unfortunately, Julia doesn't do implicit casting from int to boolUnfortunately, Julia doesn't do implicit casting from int to bool, so I have to burn an entire 3 characters just to do a comparison to zero. Saved one byte by safely assuming the number isn't negative. Still too verbose for my taste, so I have to burn an entire 3 characters just to do a comparison to zerothough.

Julia, 13 bytes

f(n)=n==0?1:n

Unfortunately, Julia doesn't do implicit casting from int to bool, so I have to burn an entire 3 characters just to do a comparison to zero.

Julia, 13 12 bytes

f(n)=n<1?1:n

Unfortunately, Julia doesn't do implicit casting from int to bool, so I have to burn an entire 3 characters just to do a comparison to zero. Saved one byte by safely assuming the number isn't negative. Still too verbose for my taste, though.

Source Link

Julia, 13 bytes

f(n)=n==0?1:n

Unfortunately, Julia doesn't do implicit casting from int to bool, so I have to burn an entire 3 characters just to do a comparison to zero.