News for hackers. Stuff that matters.
Re:Loop invariants can give you coding superpowers by Itaxpica on Wednesday April 03, 2019 @03:43PM (#19566564)
When we covered this in my CS 101 class back in the day, our professor actually had a system he had put together built on Python's unit testing infrastructure. Really, any construct in a programming language that lets you say "assert that this thing is true and if it isn't, do something" can be used for loop invariant checking.
Re:Loop invariants can give you coding superpowers by jonsen on Wednesday April 03, 2019 @04:30PM (#19567014)
Loop invariant checking should assert that if the invariant is true before the loop starts, it will also be true at the end of the loop. That’s not a general capability of assert constructs.