avva: (Default)
[personal profile] avva
(только программистам интересно, наверное)

Почему в процедуральных языках, как правило, нет оператора досрочного выхода из блока? Как break в C, но чтобы работал не только из циклов, а также внутри if-then или вообще любого блока.

Постоянно приходится делать глупые вложенные цепочки условий или некрасивые трюки типа while(1) и выполза по break'у (ну или, понятно, их аналоги в других языках).

Есть какая-то глубокая причина этому?

Re: как нету?

Date: 2003-04-16 03:28 am (UTC)
From: (Anonymous)
.. but it clearly _not_ an error condition.
Anything that is not a exception/error condition is normal control flow.

it is just another way of chaning the instruction pointer register from instruction a to instruction b.

Re: как нету?

Date: 2003-04-16 05:59 am (UTC)
From: [identity profile] 109.livejournal.com
it will be exception if you raise/throw an exception. and if it wouldn't be some unusual condition, it wouldn't require to break from 'if'.

December 2025

S M T W T F S
  123 4 56
78 9 10 11 1213
1415 1617181920
21 22 23 24 2526 27
2829 3031   

Most Popular Tags

Page Summary

Style Credit

Expand Cut Tags

No cut tags
Page generated Dec. 30th, 2025 06:33 pm
Powered by Dreamwidth Studios