managing variables

Using variables in NXT-G is a two-step process. First you create the variable, and then you use the Variable block in your program to work with the data contained in the variable.

To create a variable, open the Edit Variables dialog (shown in Figure 11-2) using the Edit ▸ Define Variables menu item. The top half of the dialog lists all the variables defined for your program.

The Edit Variables dialog

Figure 11-2. The Edit Variables dialog

To create a new variable, click the Create button, and a new variable will be created with a name like Variable 1. Change the default name to something more meaningful; more descriptive variable names will make your program ...

Get The Art of LEGO MINDSTORMS NXT-G Programming now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.