SunFounder ESP32 Starter Kit
#print("Can't run it")
print("hello world") #This is a annotationhello world
>>> %Run -c $EDITOR_CONTENT
hello world
Multi-line comment
If you want to comment on multiple lines, you can use multiple # signs.
#This is a comment
#written in
#more than just one line
print("Hello, World!")
>>> %Run -c $EDITOR_CONTENT
Hello, World!
Or, you can use multi-line strings instead of expected.
Since MicroPython ignores string literals that are not assigned to variables, you can add multiple lines of strings (triple
quotes) to the code and put comments in them:
"""
This is a comment
written in
more than just one line
"""
print("Hello, World!")
>>> %Run -c $EDITOR_CONTENT
Hello, World!
As long as the string is not assigned to a variable, MicroPython will ignore it after reading the code and treat it as if
you made a multi-line comment.
3.6.3 Print()
The print() function prints the specified message to the screen, or other standard output device. The message can be
a string, or any other object, the object will be converted into a string before written to the screen.
Print multiple objects:
print("Welcome!", "Enjoy yourself!")
>>> %Run -c $EDITOR_CONTENT
Welcome! Enjoy yourself!
Print tuples:
x = ("pear", "apple", "grape")
print(x)
3.6. 1.6 (Optional) MicroPython Basic Syntax 281