I have been programming for some time in Python, and JavaScript. I have also programmed with the arduino language which is a mix between C and C++. I was just introduced to RobotC. The syntax used for RobotC is not like any language I have learned. Can someone help explain these syntax differences so I can better understand it?
Problem 1:
When making a motor turn, you can use the following syntax:
motor[motorA] = 50
What did that line just do? In any other programming language that is how you would change a value in an array, but in RobotC it acts like a function call. Is 'motor' an array, or an object? And why do I need a function when controlling servos?
Problem 2:
When in the history of programming is this allowed?
motor[leftMotor] = motor[rightMotor] = speed = 127;
And what which of the following would this code do?
speed = 127;
motor[rightMotor] = speed;
motor[leftMotor] = motor[rightMotor];
or
speed = 127;
motor[rightMotor] = 127;
motor[leftMotor] = 127;