Can not pilot my experiment

Replying to myself:
Found the syntax error, and now I’m looking for the solution to a semantic error , i.e. ReferenceError: assignment to undeclared variable currentLoop. It’s my first time looking at code, so any help is appreciated.

EDIT: solved it thanks to this post No loop but this error "ReferenceError: currentLoop is not defined" - #7 by wakecarter