Using Comment Blocks#
This tutorial covers how to use Comment blocks in VEXcode GO. By the end, you’ll know why and how to use comments to document a project.
Comment blocks let you add notes directly into your stack of blocks, found in the Logic - Comments category in the toolbox. They don’t affect how your project runs — they’re only there to help you and others understand it.
cuando inicie :: hat events
[comment]
Programmers use comments to organize their code and make it easier to read and understand, both for themselves coming back to a project later and for others working on it. A single block’s name only describes that one block, but a comment can describe the behavior of an entire section of blocks at once — so you can understand what a stack of blocks does at a glance, without reading through each individual block.
For example, this project drives forward until it bumps into something, then backs away. As written, understanding that takes reading through every block.
cuando inicie :: hat events
conducir [adelante v]
esperar hasta <¿[bumper v] presionado? :: custom-led>
detener conducción
conducir [marcha atrás v] por (100) [mm v] ▶
Adding a comment above each section describes its behavior, making the project easier to understand at a glance.
cuando inicie :: hat events
[Drive forward until something is in the way.]
conducir [adelante v]
esperar hasta <¿[bumper v] presionado? :: custom-led>
[Back away from the object.]
detener conducción
conducir [marcha atrás v] por (100) [mm v] ▶
After connecting your robot to VEXcode, select Start to run the project. The robot will drive forward, stop and back away once it bumps into something.