|!= condition and const short
|Page 1 of 1|
|Author:||mcabre204 [ Wed Jun 03, 2015 11:23 am ]|
|Post subject:||!= condition and const short|
While trying to learn about how to program the VEX LCD screen I came across this sample code. The full code is actually in the robotc sample programs. The first thing I don't understand is the != condition, which can be seen below. In the full code you can see the const short near the top which is unfamiliar to me. If someone could help it would be much appreciated.
|Author:||Tabor473 [ Wed Jun 03, 2015 12:01 pm ]|
|Post subject:||Re: != condition and const short|
!= means not equal to. This is the same as writing !(nLCDButtons == centerButton) which is read "not" nLCDButtons equals centerButton.
So const short would be difficult to google but that is mainly because it is 2 separate things. Const(constant) means that the variable does not change after it is set initially. Defining which number refers to which button would be a good example because no other code should change which number responds to which button. Short is a data type just like int or char that stores numbers just like int but takes up less space in the robots memory. Shorts are good if you don't need a variable to be able to store numbers in the billions.
|Page 1 of 1||All times are UTC - 5 hours [ DST ]|
|Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group