This document outlines the coding style for ProjectName2, ensuring consistency and readability across the project.

Language Style

This documentation is available in English. For other language versions, please visit the ProjectName2 Documentation.

General Guidelines

  • Indentation: Use 4 spaces for indentation.
  • Line Length: Keep lines to a maximum of 80 characters.
  • Comments: Write clear and concise comments to explain the purpose of code blocks or complex logic.

Code Formatting

Variables and Functions

  • Use descriptive names for variables and functions.
  • Prefix variables with a lowercase letter and functions with an uppercase letter.

Classes and Methods

  • Use PascalCase for class names.
  • Use camelCase for method names.

Control Structures

  • Use if-else statements for conditional logic.
  • Use for and while loops for iteration.

Examples

Variable Naming

# Good
user_name = "John Doe"

Function Naming

# Good
calculate_total_price()

Class Naming

# Good
class Order

Method Naming

# Good
def get_user_details()

If-Else Statement

# Good
if user_name == "John Doe":
    print("Welcome, John!")
else:
    print("Welcome, guest!")

For Loop

# Good
for i in range(1, 11):
    print(i)

Additional Resources

For more information on coding style and best practices, please refer to the ProjectName2 GitHub repository.


Code Snippet