⌚SB Watch 2
🚚 Free fedex shipping from 97 $
🌎 WORLDWIDE SHIPPING for 25 $

Comments

Introduction

Like most programming languages, MagiScript provides commenting capabilities that allow developers to annotate their code with useful information without affecting the code’s functionality.

Single-line Comments

Single-line comments in MagiScript are similar to those in JavaScript and are denoted by the two forward slashes (//). Anything written after the // on the same line will be considered a comment and will be ignored by the interpreter. Here is an example of a single-line comment:

				
					// This is a single-line comment in MagiScript
let x = 10; // This will set x to 10.
				
			

Multi-line Comments

MagiScript also supports multi-line comments, which are useful when you want to add comments that span multiple lines. Multi-line comments start with /* and end with */. Here is an example of a multi-line comment:

				
					/*
This is a multi-line comment in MagiScript
It can span multiple lines
*/
				
			

Tips for Writing Good Comments

Good comments can make your code more readable and easier to understand, especially for other developers who may be working with the same code. Here are some tips:

  1. Be concise and to the point. Comments should provide useful information without being too verbose.
  2. Use comments to explain the purpose of your code, not what it does. The code should be self-explanatory, and comments should focus on explaining why the code exists and what problem it solves.
  3. Use comments to clarify any complex or confusing code. If a particular line or section of code is difficult to understand, add a comment to explain it.
  4. Avoid commenting on obvious things. Comments that simply repeat what the code is doing are not useful and can be distracting.
  5. Make sure your comments are up to date. If you make changes to your code, update the comments to reflect those changes.
  6. Use meaningful variable and function names to explain what are they about, so you won’t need comments.

By following these tips, you can write comments that will make your code easier to read, understand, and maintain.

Conclusion

Comments are great to write notes about the code. You can use them to understand what the code does and help the reader. Don’t overuse them, comments those are not providing new information are not useful.

General

πŸ“ƒΒ First Steps

MagiScript Editor

πŸ“ƒΒ Basics

πŸ“ƒΒ Running Your First Program

πŸ“ƒΒ App Store

πŸ“ƒΒ Atom Settings (Editor)

πŸ“ƒΒ Debugging Techniques

Examples

πŸ“ƒΒ Atom Time

🎞️ Time Practice

πŸ“ƒΒ Atom Pi (Pi Revelations)

πŸ“ƒΒ Atom Drum

🎞️ Atom Stack

πŸ“ƒΒ Atom Square

πŸ“ƒΒ Atom Level

πŸ“ƒΒ Atom THMPR

πŸ“ƒΒ Poker Hands

πŸ“ƒΒ Keyboard Numeric

πŸ“ƒΒ Keyboard NOKIA

πŸ“ƒΒ Keyboard Cursor

πŸ“ƒΒ Keyboard Media

πŸ“ƒΒ Keyboard Custom

Input/Output

πŸ“ƒΒ Buttons

πŸ“ƒΒ Vibration Motor

πŸ“ƒΒ RGB LED

πŸ“ƒΒ Devices

πŸ“ƒΒ PeekSmith

πŸ“ƒΒ SB Watch

πŸ“ƒΒ Bluetooth Keyboard

πŸ“ƒΒ Bluetooth Mouse

πŸ“ƒΒ Timers

πŸ“ƒΒ Database

πŸ“ƒΒ Events

πŸ“ƒΒ System (exit, sleep, rand)

πŸ“ƒΒ Objects (card, time)

Language

πŸ“ƒΒ Summary

πŸ“ƒΒ Comments

πŸ“ƒΒ Variable Declarations

πŸ“ƒΒ Operators

πŸ“ƒΒ Control Flow

πŸ“ƒΒ Functions

πŸ“ƒΒ Numbers

πŸ“ƒΒ Strings

πŸ“ƒΒ Arrays

πŸ“ƒΒ Objects

πŸ“ƒΒ Uint8Array