P
P
podde2020-09-24 21:41:59
1C
podde, 2020-09-24 21:41:59

1C 8.3: How to programmatically check the rows of the Table of Values ​​for parity?

Please tell me:
there is such a part of the task:
"create a table of values. Add a column to it. Fill the column with random numbers. Then delete all even numbers from the table and display the table on the screen."

It is clear that
Procedure ExecuteCode();

ValueTable1 = New ValueTable;
ValueTable1.Columns.Add("Numbers");

String = ValueTable1.Add();
String.Numbers = "3";
String.Numbers = "17";
String.Numbers = "6";
String.Numbers = "9";

... Etc.

I don't know how to bypass the table and do a parity check.
Probably something like
For Each String from Object.TK Loop
...
I always choose Answer-Solution, thanks in advance.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
K
Konstantin Nagibovich, 2020-09-24
@podde

Parity is checked through the remainder of division by two. If the remainder is 0, then it is an even number.
In 1C, the operation is the remainder of the division -%.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question