Author Options:

setup() vs. loop()? Answered

Hi Becky.

If I wanted to execute a function only once, is it correct to place it in setup instead of loop? I tried it and it worked, but I was wondering if that is the correct way.

1 Replies

bekathwiaBest Answer (author)2017-02-24

If you want something to execute once at the beginning of the program, you are correct to put it in the setup, but there are ways to program things in the loop to only execute once as well. Lots of ways to accomplish the same thing!

Select as Best AnswerUndo Best Answer