Comments
In OneVision Scripts, comments serve the same purpose as they do in other programming languages: they are non-executable text that you can include within your code to explain, clarify, or document different aspects of your code. Here’s how comments work in OneVision:
Single-line comments
Single-line comments start with // and continue until the end of the line. They are commonly used for brief explanations or annotations on a single line of code.
// This is a single-line comment
var message: string = "Hello, OneVision!";
Multi-line comments
Multi-line comments, also known as block comments, begin with /** and end with */. They can span multiple lines and are typically used for longer explanations or comments that cover multiple lines of code.
/*
This is a multi-line comment.
It can span multiple lines and is useful for longer explanations.
*/
var numberArray: number[] = [1, 2, 3, 4, 5];
Adding descriptions to variables
Multi-line comments used right before a variable declaration can be used to add some description to the created element. Hovering a variable will show the description defined for that variable.