-
Notifications
You must be signed in to change notification settings - Fork 8
02. General coding style
Diane Dowling edited this page Apr 11, 2025
·
2 revisions
| Don’t do this | Do this | |
|---|---|---|
| Combined statement | amount = int(input("Enter the amount")) |
response = input("Enter the amount")amount = int(response)
|
| Combined statement | print(get_total(n1, n2)) |
total = get_total(n1, n2)print(total)
|
Begin function and method names with a verb except where they are implementing a standard algorithm (in which case use the algorithm name).
For example, calculate_pay or validate_input (case depends on language used) or linear_search.
Begin class, structure, module, and property names with a noun.
For example, EmployeeName (case depends on language used)