评论#

介绍#

Python 中的注释用于在代码中添加解释或说明。它们不会影响代码的运行方式,可用于阐明逻辑、记录功能或暂时禁用部分代码。

Comments#

A single-line comment starts with # (spoken as “hash”) and continues until the end of the line.

def main():
    # This is a single-line comment
    brain.print("Hello!")  # Print a greeting message

# VR threads — Do not delete
vr_thread(main)

def main():
    # Print a greeting and then a farewell
    # in the Console
    brain.print("Hello!")
    brain.print("Goodbye!")

# VR threads — Do not delete
vr_thread(main)

Multiline String Comments#

Triple-quoted string comments (“”” “”” or ‘’’ ‘’’) can be used for multiline explanations. Although they are technically string objects, they can function as comments if not assigned to a variable.

def main():
    """
    This project prints a greeting message,
    followed by a farewell message in the
    Console
    """
    brain.print("Hello!")
    brain.print("Goodbye!")

# VR threads — Do not delete
vr_thread(main)