Understanding Naming Rules for Variables and Devices in VEXcode V5

In VEXcode V5, you are required to give a name to a new variable when you create one. You also have the option to change a device’s name in the Robot Configuration. 


Valid Name Rules

Variable names must be unique, but there are other specifications that the name must follow. 

Variable names are used in the following places:

  1. Device (created using Robot Configuration)
  2. Numeric (created using “Make variable”)
  3. Boolean (created using “Make a boolean”)
  4. List (created using “Make a List”)
  5. 2D List (created using “Make a 2D List”)


Here is an overview of the criteria when choosing a valid name:

Screenshot of V5 Blocks programming interface showcasing various programming blocks and their connections, illustrating the setup for a tutorial in the V5 Category Description section.

The name cannot use special characters.

VEX V5 Blocks programming interface screenshot displaying various programming blocks and their functions, used for tutorials on creating programs with VEX robotics.

The name has to begin with a letter. It cannot start with a number.

Screenshot of a VEX V5 Blocks programming tutorial, showcasing various programming blocks and their functions within the VEXcode interface, designed to guide users in creating robot programs.

The name cannot use spaces.

Screenshot of a VEX V5 Blocks programming tutorial, showcasing various programming blocks and their functions for educational robotics projects.

The name cannot be a reserved word in VEXcode. A reserved word is a word or name that VEXcode is already using.

Examples: vex, Brain, time, for, while, break, else, not.

Screenshot of VEX V5 Blocks programming interface, showcasing various programming blocks and their arrangement for a tutorial on using blocks in VEX robotics.

The name has to be unique (only used once), but you can have different cases (one uppercase and one lowercase).


Possible Name Errors

Screenshot of V5 Blocks tutorial interface showing various programming blocks and options for building robot code, illustrating the layout and features of the V5 programming environment.

When you create a variable name, if you see a “Name Taken” error, it means there is a duplicate name in any of the groups above.

Diagram illustrating various blocks used in Vex Robotics V5 programming tutorials, featuring labeled components and connections to aid understanding of programming concepts.

You may encounter a case when opening a project made in an earlier version of VEXcode V5 that has a duplicate variable name. This will cause an error when compiling and you will see the following type of error message

The error message above shows the following problems:

  • The name “myvariable” was found as a numeric variable and a boolean variable. 
  • The name “awesomeVar” was found as a numeric variable and a boolean variable. 

To resolve the error, one of the duplicates will need to be removed or changed so they are unique.

For more information, help, and tips, check out the many resources at VEX Professional Development Plus

Last Updated: