Free Trial

Safari Books Online is a digital library providing on-demand subscription access to thousands of learning resources.

  • Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • PrintPrint

comments

Programmers use comments to add descriptive text to their programs. Every programming language that I am aware of allows programmers to do this, and NXT-G is no exception. Use comments to tell other programmers how your program works or why you made certain decisions. For example, you could add a comment to the previous program to explain why you added the Wait Time block.

In the previous chapter, I mentioned that a good program should be easy to modify and understandable to other programmers. Good comments are important in achieving both of these goals. It can be very difficult to figure out how a program works just by looking at the settings for each block. A short description in plain English (or whatever language you speak) will make your program much easier to understand. Think of how you might describe your program to a friend. You wouldn’t just list the blocks you use; instead, you’d describe what the program does as a whole, and you might also explain how the more complicated parts of your program work. Use comments to add this type of information to your program so it will be much more useful to oth....


  

You are currently reading a PREVIEW of this book.

                                                                                                                    

Get instant access to over $1 million worth of books and videos.

  

Start a Free 10-Day Trial


  
  • Safari Books Online
  • Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • PrintPrint