added conditional looping method and nil method