Go Down

Topic: Not sure the right wording but can I DEFINE an entire block of code with 1 Line? (Read 1 time) previous topic - next topic

AWOL

Quote
Related to my question regarding Functions... can I include a "break" command inside of a function definition? What about an "if" statement?
Both "setup" and "loop" are simply functions; if you can put it in one of those, you can put it in your own.
"Pete, it's a fool looks for logic in the chambers of the human heart." Ulysses Everett McGill.
Do not send technical questions via personal messaging - they will be ignored.

Jimmy60


Thanks to all who've replied. btw This program is from the Arduino examples (called Sweep).

Related to my question regarding Functions... can I include a "break" command inside of a function definition? What about an "if" statement?




Don't expect break to leave the function though, it's for getting out of a loop. To get out of a function before it normally finishes anyway use return.

Good info here: http://cplusplus.com/doc/tutorial/functions/

Go Up