Printf vs debug

I have seen examples that use debug() and other that use printf() for printing text to console. What is recommended? Why is there a difference in official examples?

You don’t want to debug in release build. I believe printf() prints in release while debug() gets optimized away.

OK, i get it. Thanks.