eupolicy.social is one of the many independent Mastodon servers you can use to participate in the fediverse.
This Mastodon server is a friendly and respectful discussion space for people working in areas related to EU policy. When you request to create an account, please tell us something about you.

Server stats:

213
active users

#while

0 posts0 participants0 posts today

Дуже жаль що в C++ немає блоку else після циклів for і while як у Python.

>>> for i in range(6):
...     print(i)
... else:
...     print('Succesful')
... 
0
1
2
3
4
5
Succesful
>>>

Або так:

>>> for i in range(6):
...     if i > 3:
...         break
...     print(i)
... else:
...     print('Succesful')
... 
0
1
2
3
>>>

В Python цей блок виконується у випадку успішного завершення циклу, але мені здається було б логічно зробити навпаки, коли цикл завершується примусово командою break або при першій перевірці умова не виконана.

social.net.uaSocial.Net.Ua