print()
Try it yourself →Prints the value to the console and moves to the next line.
Syntax
print(object)
Description
Converts the given object to text, prints it, and automatically adds a newline at the end. It is the most commonly used debugging and output command.
Example
void main() {
print("Hello");
print(42);
}Expected output
Hello 42
When to use?
Showing results, debugging.
Common mistakes
- ⚠️ Forgetting a semicolon (;) at the end of a line causes a compilation error.