Skip to main content
added 43 characters in body
Source Link
Jonathan Allan
  • 110.1k
  • 7
  • 65
  • 282

><>,  6  5 bytes

-1 thanks to Jo King!

:n?!;

Try 0 online!
Try 1 online!

How?

Instruction pointer starts at the top left (i.e. 0 or 1) facing right. If the instruction pointer leaves the code it wraps around to the other side, continuing in the same direction.

X:n?!; -               X=0                X=1
X      - push X          {0}                {1}
 :     - duplicate       {0,0}              {1,1}
  n    - pop & print     {0,} "0"           {1} "1"
   ?   - pop & if...     {}                 {}
    !  - ...truthy:      skip & wrap to X
     ; - ...falsey:                         exit

><>,  6  5 bytes

-1 thanks to Jo King!

:n?!;

Try 0 online!
Try 1 online!

><>,  6  5 bytes

-1 thanks to Jo King!

:n?!;

Try 0 online!
Try 1 online!

How?

Instruction pointer starts at the top left (i.e. 0 or 1) facing right. If the instruction pointer leaves the code it wraps around to the other side, continuing in the same direction.

X:n?!; -               X=0                X=1
X      - push X          {0}                {1}
 :     - duplicate       {0,0}              {1,1}
  n    - pop & print     {0,} "0"           {1} "1"
   ?   - pop & if...     {}                 {}
    !  - ...truthy:      skip & wrap to X
     ; - ...falsey:                         exit
added 43 characters in body
Source Link
Jonathan Allan
  • 110.1k
  • 7
  • 65
  • 282

><>, 6 6  5 bytes

-1 thanks to Jo King!

::n?!;

Try 0 online!Try 0 online!
Try 1 online!Try 1 online!

><>, 6 bytes

::n?!;

Try 0 online!
Try 1 online!

><>,  6  5 bytes

-1 thanks to Jo King!

:n?!;

Try 0 online!
Try 1 online!

Source Link
Jonathan Allan
  • 110.1k
  • 7
  • 65
  • 282

><>, 6 bytes

::n?!;

Try 0 online!
Try 1 online!