1

Topic: To quit two cycles in With

How it is beautiful to me to quit two cycles? Without condition2.

for (i=0; i <100; i ++)
{
for (j=0; j <100; j ++)
{
if (condition1)
{
condition2 = 1;
break;
}
if (condition2)
break;
}
}

2

Re: To quit two cycles in With

Was mistaken. Correctly so.

for (i=0; i <100; i ++)
{
for (j=0; j <100; j ++)
{
if (condition1)
{
condition2 = 1;
break;
}
}
if (condition2)
break;
}

3

Re: To quit two cycles in With

Well unless goto

4

Re: To quit two cycles in With

i = 100;
break;

5

Re: To quit two cycles in With

To replace for on while...

6

Re: To quit two cycles in With

Yes. goto the unique decision. Thanks.

7

Re: To quit two cycles in With

Dima T wrote:

i = 100;
break;

.... Artfully. Thanks smile

8

Re: To quit two cycles in With

Well when desire structurally to program does not turn to a goto-phobia.

9

Re: To quit two cycles in With

jenya7 wrote:

As it is beautiful to me to quit two cycles? Without condition2.

for (i=0; i <100; i ++)
{
for (j=0; j <100; j ++)
{
if (condition1)
{
condition2 = 1;
break;
}
if (condition2)
break;
}
}

goto

10

Re: To quit two cycles in With

mayton wrote:

it is good when the desire structurally to program does not turn to a goto-phobia.

These tangling merits of case the statement.
And it here that a cycle for are not a part of the constructions resolved in structured programming.
Time this example does not follow to structured programming recipes it and to break here application goto it is impossible .

11

Re: To quit two cycles in With

jenya7 wrote:

it is passed...
.... Artfully. Thanks smile

It is not artful". This frank badly smelling code.
For an output from N nested loops certainly it is possible to use GOTO, but its necessity still is required to be justified, after all all cycle to suppose in function and to quit all cycles through return. It both solves the task, and promote effective structurization of the code.

12

Re: To quit two cycles in With

hVostt wrote:

...
For an output from N nested loops certainly it is possible to use GOTO, but its necessity still is required to be justified, after all all cycle to suppose in function and to quit all cycles through return.
...

smile))
These are five points for "code structurization".

13

Re: To quit two cycles in With

booby wrote:

it is passed...
These tangling merits of case the statement.
And it here that a cycle for are not a part of the constructions resolved in structured programming.
Time this example does not follow to structured programming recipes it and to break here application goto it is impossible .

I Ask to show a source of knowledge who  forbade.

booby wrote:

it is passed...
smile))
These are five points for "code structurization".

it is similar, it would be desirable to confirm your fabrications with normal textbooks.

14

Re: To quit two cycles in With

Siemargl;
What do you name fabrications?
And on yours too "structured programming" implies a multiplicity of resets from the code unit?
Can, you will specify "textbook" where to such structured programming learn.

15

Re: To quit two cycles in With

booby;
Your assumptions of "abnormality".
And if you write, about "for - are not a part of the constructions resolved in structured programming" - that confirm with a source.
plural reset is forbidden it is not recommended from function, instead of from the unit.

16

Re: To quit two cycles in With

booby wrote:

smile))
These are five points for "code structurization".

Itself joked - itself laughed? Well-well.

17

Re: To quit two cycles in With

booby wrote:

that you name fabrications?
And on yours too "structured programming" implies a multiplicity of resets from the code unit?

If decided to pose as  on determinations, work to argue for the words the correct determinations, and also , not to look ridiculous.

18

Re: To quit two cycles in With

Siemargl wrote:

booby;
Your assumptions of "abnormality".
And if you write, about "for - are not a part of the constructions resolved in structured programming" - that confirm with a source.
plural reset is forbidden it is not recommended from function, instead of from the unit.

1) in a part for - apprx.
Was specific in c/c ++ for and it is admissible and can eat to be a structured programming part;
Since the output condition is explicitly formulated as a logical condition.
In many other languages languages are not present possibility to formulate an end condition for directly in title.
Therefore for such languages it is not accepted to consider for as a part of toolkit of "structured programming" on the base of plural reset from a cycle.
But in this case, yes, the joke appeared lubricated.
That is - as a result I recognize - it is not went right.
2) by a part block function.
Function - a special case the code unit.
The structured programming is formulated in relation to code units;
As though they were not called, as all program is considered as sequence code units, each of which has a unique input and a unique output.
Actually a cycle here it is not simple a construction in which there can be any repeated sequence of units, and a construction forming, generating own the code unit .
As well as a choice construction iff.
What of units or sequence of units receives own a name (functions, for example), and, thus has an opportunity bindings in different sequences of units by instructions of their names - the in itself structured programming does not interest.
The program - sequence of units.
Cycle and choice operation - formations recognized for lawful methods
New units, under a condition observance of a principle of uniqueness of an input and an output.
Textbooks - I do not know.
Possibly, now to structured programming any more do not learn.
And so - any textbook 30-40 summer prescription.
And yes, in the note turned to hVostt I laughed.
And over a sentence to make a hara-kiri return from cycle interiors.
You, possibly, live in other countries, therefore our sarcasm simply do not understand.

19

Re: To quit two cycles in With

20

Re: To quit two cycles in With

booby wrote:

under a condition observance of a principle of uniqueness of an input and an output.

That for a principle such for what it is necessary also what task solves it, can explain?

21

Re: To quit two cycles in With

booby;
Still the moment, many do not love and touchingly screw up the face, when about it talk comes.
Function can be tested.
How you are going to test the unit of the code of type for, if, etc. in the source code, time you do not see any difference from the point of view of the structural code?

22

Re: To quit two cycles in With

To close a subject of useless flood. Here Dijkstra's original textbook
https://www.ozon.ru/context/detail/id/139232156/

23

Re: To quit two cycles in With

From a permission of misters of Kerningana and Richi I will result a fragment of a source code from their book.

3.8 Operator goto and labels.

found = 0;
for (i=0; i <n &&! found; i ++) {
for (j=0; j <m &&! found; j ++) {
if (a [i] == b [j]) found = 1;
}
}
if (found) {....}

24

Re: To quit two cycles in With

mayton;
Yes they there are often exhausted, is normal if so it would be desirable  without goto the inner loop in separate  would solve a problem "that did not rush to eyes"

25

Re: To quit two cycles in With

. 2005. OMG.
http://www.sql.ru/forum/167293/chem-plo … yy-perehod