• What is variable and operators
  • What are they used for
  • Very basic example
  • This is the boring stuff, may need to go on with the graphics content and then come back to these concepts
  • Variables are like lockers (ref to Soon's notes[link can't find])
    • Different lockers can only fit certain values (for strong-type like JAVA/C/C++)
    • Example:

      Variable
      int i;	// holds integer
      float f;	// holds floating point (approximate understanding, can have .xxx : https://en.wikipedia.org/wiki/Floating-point_arithmetic)
      boolean b;	// holds true/false
      
      i = 10;	// now i is 10
      i = 20;	// the previous value is discarded , now i is 20
      i = i + 10;	// this gets the content from the locker and do some operation and puts back in the same locker
      
      f = i;	// this works, f now holds 20.0
      i = f + 30;	// this doesn't work, why?
      
      b = false;	// b is now false
      b = i + 10 > f;	// what is b now?
  • Basic Operators Ref: https://www.tutorialspoint.com/java/java_basic_operators.htm