A loops value of -1 is passed through as in the Python implementation and is intended by that implementation to mean indefinite repetition. Confirm that interpretation against your Arduino firmware.