Understanding the Main Structure of a VEXcode Pro V5 Project

The VEX Visual Studio Code Extension has replaced VEXcode Pro V5, which is now end-of-life.

VEXcode Blocks and VEXcode Text remain actively developed and supported for all VEX platforms.

Screenshot of a VEX V5 robot configuration tutorial, showcasing various components and their connections, designed to assist users in understanding assembly and programming for robotics projects.

The main structure is where the project execution begins. In other words, instructions containing devices, commands, and parameters are added here, the combination of which, when executed, determine specific robot behaviors.

Notice that the main structure has an opening and closing curly brace

Screenshot of a VEX V5 robot programming interface, showcasing various coding blocks and options for creating a robotic program, relevant to the V5 Category Description tutorials.

An opening brace must always be paired with a closing brace.

Between the curly braces of the main structure is where you can add instructions to program your robot

Screenshot of V5 category description tutorial, illustrating key features and functionalities of the V5 robotics system, including labeled components and usage instructions.

Whenever you start a new program, inside the main structure is the line of code vexcodeInit();

Diagram illustrating the V5 robot design components, showcasing various parts and their functions, relevant to V5 category tutorials.

This command sets up and initializes all devices (e.g. motors, sensors) before your code begins. Do not delete the vexcodeInit();

In a simple project that drives the robot forward, the instruction contains three sections:

  • The device
  • The command
  • The parameters

Screenshot of a tutorial interface in V5, showcasing various features and options available for users, including navigation menus and instructional elements.

The device and the command are separated by a period called a “ dot operator

Around the parameters of the driveFor command, there is a set of parenthesis. This is another example of paired punctuation (like the curly brace). Each parameter is separated by a comma.  

At the end of the line of code is a semicolon. The semicolon tells the compiler that this instruction is complete and should proceed to the next instruction.


VEX V5 robotics system components diagram showing various parts and their labels, illustrating the setup for educational tutorials.

If multiple instructions are in your project, the project’s instructions will run from left to right and top to bottom.

Based on the placement of the semicolons, VEXcode Pro V5 would run the first line and then the next. It would know to move to the second line because of the semicolon.

When the project reaches the closing curly brace of the main structure, the project ends.

Screenshot of the VEX V5 robotics system tutorial interface, showcasing various categories and options for users to explore educational resources and guides related to V5 robotics.

In the project, the robot would drive forward for 200 millimeters (line 24), then drive the robot forward 50 millimeters (line 25) before the program is complete.

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

Last Updated: