Σχόλια#
Εισαγωγή#
Τα σχόλια στην Python χρησιμοποιούνται για την προσθήκη επεξηγήσεων ή σημειώσεων μέσα στον κώδικα. Δεν επηρεάζουν τον τρόπο εκτέλεσης του κώδικα και είναι χρήσιμα για την αποσαφήνιση της λογικής, την τεκμηρίωση της λειτουργικότητας ή την προσωρινή απενεργοποίηση τμημάτων του κώδικα.
Comments#
A single-line comment starts with # and continues until the end of the line. Comments can appear on a line alone, or on the same line as actual code. These are called “inline comments.”
# This is a single-line comment
controller.screen.print("Hello!") # Print a greeting message
# Print a greeting and then a farewell
# in the Console
controller.screen.print("Hello!")
controller.screen.print("Goodbye!")
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.
"""
This project prints a greeting message,
followed by a farewell message in the
Console.
"""
controller.screen.print("Hello!")
controller.screen.print("Goodbye!")