3 ms·
> So what we can do to update the value "inplace" is to clear the screen, position the cursor back at the top left of the screen, and then re-print the values.
by WalterGR 4y ago
> So what we can do to update the value "inplace" is to clear the screen, position the cursor back at the top left of the screen, and then re-print the values.
> …
> Now at every iteration you can just clear out your screen and actually just show one item at a time.
While the larger concept is indeed useful, clearing the screen to display one line of debug output is pure insanity.
There’s an ANSI escape code that moves the cursor to the beginning of the current line. For the love of all things good and true, use that instead!