Skip to main content
code improvement
Source Link
Marijn
  • 171
  • 3

Perl 5, 2828 25 bytes

-3 bytes thanks to @neil!

$a++;print"\e[D$a"ifprint"\e[D$a"if($a++$a!=2); 

Moves the cursor backwards (does nothing on start of line) and prints the value of $a, first and third time (i.e., the third time a 1 is printed, the cursor moves, and a 3 is printed on the position of the 1).

Perl 5, 28 bytes

$a++;print"\e[D$a"if($a!=2); 

Moves the cursor backwards (does nothing on start of line) and prints the value of $a, first and third time (i.e., the third time a 1 is printed, the cursor moves, and a 3 is printed on the position of the 1).

Perl 5, 28 25 bytes

-3 bytes thanks to @neil!

print"\e[D$a"if(++$a!=2); 

Moves the cursor backwards (does nothing on start of line) and prints the value of $a, first and third time (i.e., the third time a 1 is printed, the cursor moves, and a 3 is printed on the position of the 1).

Source Link
Marijn
  • 171
  • 3

Perl 5, 28 bytes

$a++;print"\e[D$a"if($a!=2); 

Moves the cursor backwards (does nothing on start of line) and prints the value of $a, first and third time (i.e., the third time a 1 is printed, the cursor moves, and a 3 is printed on the position of the 1).