View Single Post
  #14   Spotlight this post!  
Unread 01-08-2008, 17:01
ComradeNikolai ComradeNikolai is offline
Registered User
AKA: Nicholas
FRC #2603 (Team Hornet)
Team Role: Mentor
 
Join Date: Feb 2008
Rookie Year: 2008
Location: Medina, Ohio
Posts: 203
ComradeNikolai is a splendid one to beholdComradeNikolai is a splendid one to beholdComradeNikolai is a splendid one to beholdComradeNikolai is a splendid one to beholdComradeNikolai is a splendid one to beholdComradeNikolai is a splendid one to beholdComradeNikolai is a splendid one to behold
Re: Almost balancing Scooter

Quote:
Originally Posted by billbo911 View Post
This is where my lack of expertise shows it's ugly head. If I am correct, the code will not execute as desired if left this way. One of the places will prevent the "angle" to ever be set to "0" if it is in the window you defined. That being the case, the "flag" will never be set to "0" either.
The brackets can actually be left out in this case, since in C an if-then structure is formatted as "if-conditional statement;" where "statement" is the one line executed if the conditional is true. However, since one usually needs more than one statement per conditional, the brackets allow you to put multiple statements into a block, which C thent treats as one statement for the purpose of the conditional.

That having been said, the addition of the brackets certainly makes it more readable and, if you ever have to add another statement into the block, it makes it much easier to do it quickly.
__________________
I cut myself shaving with Occam's razor.


Last edited by ComradeNikolai : 01-08-2008 at 17:05. Reason: grammar