Fix loop bugs and add while loop.
Add support for negative numbers, and new example.