-4
\$\begingroup\$

This is a very simple challenge, and it is to print the numbers -1, 0, and 1.

The following paragraph is credited to Print numbers from 1 to 10
Your output format can be whatever your language supports. This includes arbitrary separators (commas, semicolons, newlines, combinations of those, etc., but no digits), and prefixes and postfixes (like [...]). However, you may not output any other numbers than -1 through 1. Your program may not take any input. Standard loopholes are disallowed.

This is , so the shortest answer in bytes wins. Happy golfing!

\$\endgroup\$
8
  • 7
    \$\begingroup\$ I don't think we need one of these for all number ranges. \$\endgroup\$ – Dennis Feb 21 '18 at 2:56
  • \$\begingroup\$ @Dennis but all the others start at 0 or 1. plus, I'd also like to see if any get it in 2 bytes or less \$\endgroup\$ – robbie Feb 21 '18 at 3:00
  • 4
    \$\begingroup\$ Starting at -1 might be annoying for languages that have only unsigned integers, but it will make no difference whatsoever for all others. If you want to satisfy your 2-byte curiosity, you can join us in The Nineteenth Byte. \$\endgroup\$ – Dennis Feb 21 '18 at 3:06
  • 2
    \$\begingroup\$ Does this count? \$\endgroup\$ – ETHproductions Feb 21 '18 at 7:00
  • \$\begingroup\$ @ETHproductions yes! \$\endgroup\$ – robbie Feb 22 '18 at 1:54
3
\$\begingroup\$

Jelly, 3 bytes

-r1

Try it online!

1r-

Try it online!

-ŒR

Try it online!

1ŒR

Try it online!

Ø-Ż

Try it online!

Ø+Ż

Try it online!

-rN

Try it online!

1rN

Try it online!

2Ż’

Try it online!

3Ḷ’

Try it online!

and a bonus one:

M, 2 bytes

-R

Try it online!

\$\endgroup\$
1
  • \$\begingroup\$ This is what we call "flexing". Have my upvote. \$\endgroup\$ – StackMeter Apr 13 at 17:01
2
\$\begingroup\$

Pyt, 4 bytes

3ř⁻⁻

Try it online!

Explanation:

3      Push 3
ř      Push [1,2,3]
⁻⁻     Decrement twice
       Implicit print
\$\endgroup\$
2
\$\begingroup\$

R, 9 bytes

cat(-1:1)

Try it online!

\$\endgroup\$
0
\$\begingroup\$

JavaScript, 19 15 bytes

[-1,0,1].map(alert)

alert([-1,0,1])

\$\endgroup\$
0
0
\$\begingroup\$

Python - 11 bytes

print -1 0 1

I would say "Good luck improving this.", but past experience has taught me never to assume: though, this won't be easily beat (for i in range(3), %ding the spaces and %sing the 1s are all overweight, so you can eliminate those.) (Edit 1: -4 due to caird, as is expected)

\$\endgroup\$
4

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.