Skip to content

Commit

Permalink
add hint about indentation
Browse files Browse the repository at this point in the history
  • Loading branch information
sgmdlt authored Sep 11, 2024
1 parent b4c8075 commit a7efffd
Showing 1 changed file with 18 additions and 0 deletions.
18 changes: 18 additions & 0 deletions modules/48-conditionals/40-if-else/ru/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -49,3 +49,21 @@ def get_type_of_sentence(sentence):
```

Чтобы конструкцию было легче оформлять, старайтесь выбирать проверку без отрицаний и подстраивайте содержимое блоков под нее.

На примере использования `else` видно, как важно не забывать отделять блоки.

```python
if number > 10:
print("Number is greater than 10")
else:
if number == 10:
print("Number is exactly 10")
# мы забыли сделать отступ
# и получим синтаксическую ошибку
else:
print("Number is less than 10")

# else:
# ^
# SyntaxError: invalid syntax
```

0 comments on commit a7efffd

Please sign in to comment.