Friday, July 19, 2013

Operators

Arithmetic


  • +    -    *    /    %

Assignment


  • =    +=    -=    /=    %=    ++    --    &=    ^=    |=    <<=    >>=

Comparison


  • ==    !=    >    <    >=    <=

Logical


  • &&    ||    !

Bitwise


  • &   |   ^   <<   >>   ~
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>

x = 3 / (float)2; //to get the exact answer, one of the numbers needs to be converted to a floating point


>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>

Some operators take precedence over others. In order to decide in which order our statements will run, we can use parentheses.

>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>

Take string variable A, and concaffeinate it with a new string, then store that in string variable B:
a = "Hella";
b = a + "Word";

Append the new string to the original value of A and store it as the new concatenated A value:
a = "Hella";
a += "Word";















No comments:

Post a Comment