Debugging in 3DE: The Yellow Triangle

Unlike a red X, a yellow triangle that shows up to the left of your code is not a showstopper. Your code will probably run even if lines in your code are marked with yellow triangles, but it may not run correctly. It’s best to get rid of those triangles as they come up.

Let’s see this in action by writing some more bad JavaScript (but not too bad). First, remove the badjavascript line from the previous section. Then add the following lines:

​ favoriteFood;
​ eat(favoriteFood);

In this case, 3DE will tell us via the yellow triangle that the food line is not doing anything.

images/console_for_fun_and_fixing/food_unassigned.png

To fix the problem, we can ...

Get 3D Game Programming for Kids, 2nd Edition 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.