Timeline for Display 0 - 1000 - 0 each on a separate line
Current License: CC BY-SA 4.0
10 events
when toggle format | what | by | license | comment | |
---|---|---|---|---|---|
Mar 17, 2021 at 15:06 | comment | added | Arnauld | @Neil Nice improvement. I've turned this into community wiki, so feel free to edit further if you find something for the second option. | |
Mar 17, 2021 at 15:05 | history | edited | Arnauld | CC BY-SA 4.0 |
added another version; Post Made Community Wiki
|
Mar 17, 2021 at 13:24 | comment | added | Neil |
I think echo 0;for(;$n<2e3;)echo'<p>',min(++$n,2e3-$n); is shorter for the first option, but I couldn't seem to adapt it for the second option.
|
|
Mar 17, 2021 at 11:54 | history | edited | Arnauld | CC BY-SA 4.0 |
saved 7 bytes
|
Mar 17, 2021 at 11:49 | comment | added | Sisyphus |
for(;$i<2001;)echo 1e3-abs(1e3-$i++),'<p>'; (thx @xnor)
|
|
Mar 17, 2021 at 11:49 | comment | added | xnor |
It looks like 1e3-abs($n-1e3) is a byte shorter than the ternary. And shifting indices probably shortens that too.
|
|
Mar 17, 2021 at 11:47 | comment | added | Sisyphus |
echo takes multiple arguments, so you can remove the brackets and replace . with ,
|
|
Mar 17, 2021 at 11:46 | history | edited | Arnauld | CC BY-SA 4.0 |
added a shorter version
|
Mar 17, 2021 at 11:43 | comment | added | dev | i was trying turnery but couldn't get it to work. | |
Mar 17, 2021 at 11:41 | history | answered | Arnauld | CC BY-SA 4.0 |