Bookmark this page: Arduino Reference - Arduino Reference
When you have the Arduino IDE open, open your browser to that page as a quick reference to commands in the code that you may not know exactly. Don't guess with code, know. None of it is there for decoration, it all runs as compiled.
In the IDE, use the AutoFormat tool often when writing. It will let you know a whole range of errors you can fix right then +and+ it will make your indents nice and clean.
Your IDE is packed with examples. There are the Tutorial Examples and the Library Examples. Just stay away from Tutorial Examples section 4! It teaches BAD HABITS for ARDUINO that are maybe good ones on PC's, the use of capital-S Strings that can/will play havoc with your limited heap space (global variables) in RAM. An Uno has 2K RAM for everything, it's best to use C strings that are simply arrays of char variables to hold text values in. You can address/access/change any element directly and that's all that changes.
There are some differences between standard C/C++ and Arduino C/C++.
Standard C/C++ has an int main() function that returns an error code.
Arduino has that but you don't see it. What you see is
void setup() // runs once
void loop() // runs over and over
which is perfect for a microcontroller running automation or a one-time demonstration run in setup() only.
If you only do a little in any pass through loop(), what's inside loop() will run > 100KHz.
I set up a 32 bit variable as a counter and a 16 variable as a time mark. In void loop() that adds 1 to the counter and then checks to see if 1 second has passed within 4 microseconds and if it has, the counter value is printed and then zeroed then the time mark is set ahead 1 second and then loop() runs again, etc. That's how I know it runs at over 111KHz, doing very little.
When I add a blinking led that also has a time mark, the speed drops to to 81KHz. With button as well, 67KHz but that includes debouncing the button.
But YOU only want to do simple things so you may get > 100KHz responses.