Code Completion
Intelligent Code Completion (IntelliSense)
As you begin typing the script, the complete intelligent code will present a selection of functions based on your input. You may use the arrow Up/Down keys to select the appropriate command or continue typing. Pressing the ESC key will hide the dialog.
*Note: Remember that when a code snippet is generated by intellisense, the case sensitivity matters. There are naming conventions for programming languages, which is why case sensitive matters. It's also important to note that a capital 'B' is different than a small 'b' because programming languages use their ASCII values.
What is the . (period)?
- classes (which group functions) start with uppercase letters (i.e. Servo)
- functions start with lowercase letter (i.e. sleep)
So if you look at the Console class, it has a dropdown with many options...
The "Console" is the class (which groups functions) and "log" is the function. If you press "Console." with a period at the end, you'll see all the functions that live under Console..
What is a Class?
In both JavaScript and Python, a class
is a blueprint for creating objects. A class encapsulates data for the object (properties) and methods to manipulate that data. It's a way to bundle data and functionality together.
What is a Method?
A method
is a function defined within a class that operates on the data contained in the class. Methods are used to define the behaviors of an object. The method is invoked on an instance of the class, allowing it to access and modify the properties of that instance.
Class.Method() Notation
In Synthiam ARC's context, when you see a notation like Servo.setServoPosition()
, it means the setServoPosition
method is being called on the Servo
class. This method would typically be used to control a servo's position in a robotic project.
The period (.
) separates the class name from the method name, indicating that the method belongs to the class.
Case Sensitivity
Both JavaScript and Python are case-sensitive languages. This means that servo
, Servo
, and SERVO
would be considered different identifiers. Therefore, it is crucial to use the exact case as defined in the Synthiam ARC documentation when referring to classes and methods.
Example in JavaScript
class Servo {
static setServoPosition(position) {
console.log(`Setting servo position to ${position}`);
}
}
// Correct way to call the method
Servo.setServoPosition(90);
// Incorrect - case sensitivity matters!
// servo.setservoPosition(90); // This will cause an error
Example in Python
class Servo:
@staticmethod
def setServoPosition(position):
print(f"Setting servo position to {position}")
# Correct way to call the method
Servo.setServoPosition(90)
# Incorrect - case sensitivity matters!
# Servo.setservoposition(90) # This will cause an error
Remember to always refer to the Synthiam ARC documentation for the correct usage of classes and methods in your projects.