Choosing good names for variables, functions, and constants is one of the most important habits you can build as a programmer. Here is what to use, what to avoid, and why.
armPosition is self-documenting. x is not.int x = 0;
int y = 0;
bool f = false;
void a() {
if (f) {
x = 200;
}
}
int armTargetDeg = 0;
int clawSpeed = 0;
bool intakeRunning = false;
void raiseArm() {
if (intakeRunning) {
armTargetDeg = 200;
}
}
Both blocks do exactly the same thing. But six months from now — or the night before a competition — only the second one tells you what it does at a glance.
val2 does.x, v, f — meaningless outside a 2-line context. Allowed only in simple loop counters like i, j.leftFrontMotorCurrentSpeedForAutonomous — exhausting to type and read. Aim for 2–3 meaningful words.armTargetDeg, intakeSpeed, driveLeftVoltage — specific enough to understand, short enough to write.armSpd saves 3 keystrokes and costs 10 seconds of confusion every time someone reads it. Write armSpeed.A "magic number" is a raw number with no explanation. Motor arm(5) tells you nothing. If the arm motor moves to port 7, you have to hunt for every 5 in the code. Use named constants instead.
int or a function while is a compile error. Naming something chassis when EZ Template already defines it will cause a conflict. This list covers the most common ones you will encounter.These are built into the C++ language itself. The compiler will always reject them as identifier names.
These are not reserved keywords but are defined by PROS. Using the same name for your own variable creates a conflict or hides the PROS version.
EZ Template defines these globally or within the ez namespace. Creating your own variable with the same name will cause unexpected behavior.
pros::E_MOTOR_BRAKE_HOLD) are symbols that already exist in a linked library — redefining them creates an ambiguous symbol that the compiler cannot resolve. Naming conventions (camelCase, PascalCase, SCREAMING_SNAKE) encode type information visually — a form of Hungarian notation that helps humans and IDEs simultaneously.delay in a PROS project cause problems even if it compiles?delay is a reserved C keyword and cannot be used at allpros::delay() function in that scope, potentially causing calls to your variable instead of the PROS function, leading to a type error or unexpected behavior