check if newExample is defined before retreiving code (thanks @jeroenooms)