Here I took the inermenting of avariable and split it off into a subprogram. I also added some meters and some more functuality (speed of increase). Subprograms can be used multiple times, so they cut down on compile times, and complexity of the program. Also, if an error developes in the pubprogram it only needs to be fixed in once, instead of in every place you used it.

Variables and Fun!

Here we are adding one to a value five times, once the value hits five we quit the program. Easy enough.

Branch Functions

We are messing with the branch functions available in RoboPro softwhare, in order to learn and apply them.
Branches allow logic to be done. Without branches the program will work with gates, that is once it gets somewher it will wait untill something occurs. With branches, it can go along a different path depending on a variable or the return of a function.

A normally open switch could be used on a segway to only allow power to the drive train when there is someone on the segway.

A normally clossed switch could be used onthe robot as a limit switch. When pressed (By, say and arm reaching its upwardmost point), it could put power to the motors.