1C 8 List of values \u200b\u200bfrom the list. Additional methods for array

What is this article

This article continues the cycle of articles "First Steps in Development for 1C". It addresses the principles of working with universal collections. After reading the article, you will learn:

  • What are universal collections when and in what cases should they be used?
  • What is common to all universal collections? What techniques can be used to work with all of them?
  • What is an array, how and when to use it? What methods does he have?
  • Why use the structure? What is her difference from the massif?
  • In what cases use the list of values? How to display it on the form?
  • Compliance - what is it and when to use it? What are the advantages regarding the structure?
  • What is the table of values? How to describe its structure? How to add / delete lines? How to bring it to the form?
  • Tree of values \u200b\u200b- for what is used? How to fill and output? How to work with him?

Applicability

The article discusses the 1C platform: Enterprise 8.3 of the urgent edition.

As in 1c working with universal collections

The set of values \u200b\u200bis a certain container in which any number of elements can usually contain. In this case, any hard restrictions on the data type is often not superimposed.

In the universal collection you can add values. All values \u200b\u200bin the collection can be circumvented. These collections are used mainly for any processing in algorithms. Those. This is some dynamic structures that exist during the operation of the algorithm.

It is important to understand that the collections are not stored in the database (about the type of data storage of values \u200b\u200bthat almost any type of data can be saved).

Exist different kinds Universal collections: array, structure, compliance, fixed array, table of values, Table parts etc. But all collections have similar behavior.

The collection can be created as a result of a function of any function (the function returns the universal collection as the value).

You can get a new collection manually by contacting the constructor and creating an instance of the class.

For example: Our massive \u003d new array;

Designers for many universal collections are parameterized.

So, in the designer for you can specify the number of items in the respective measurements. Those. can immediately declare multidimensional .

The corresponding Designer Description is in the Syntax Assistant.

Thus, using the parameters of the constructor, you can immediately ask the desired behavior. this object.

But the parameters are optional, the developer can not specify them and continue to determine the behavior of the array as it seems necessary.

Almost any universal collection can be created using a constructor (exception are tabular parts that act as configuration objects).

For universal collections there are common concepts as an index and number. Each element of the collection has an index. In this case, the index begins with scratch.

In order to refer to the element NashimassivYou can use the appeal to the index, for this index is indicated in square brackets.

For example, Nashimassiv. Note, in this case, the system returns an array element with an index 3, and in order this is the fourth element of the array.

For some collections there is also the concept of the line number. Row number begins with a unit. For example, for the table part there is a property as the line number. It is important to keep in mind that if we know the line number and want to contact the index, then as an index, you should use a value per unit smaller line number.

The concept of the line number is far from all collections, but mainly in those that can be displayed in the user interface.

For all collections, bypassing the elements of the collection is used. Bypass is possible in two ways: cycle for and cycle for each of.

For most universal collections, methods are applicable: quantity, index, add, insert, delete and find.

Quantity is a function that returns the number of elements of the collection. It can be used before the cycle ForAs presented in the figure.

The index method exists not in all collections, but only those on the elements of which can be referred. As an example, you can bring Tables Satiments.

Tables- This is a specific collection of rows, lines may contain different columns with different types of values.

Each line is an independent entity. You can get a link to it, through this line you can access the values \u200b\u200bof the speakers in this row.

The index method allows you to determine which index corresponds to this string (that is, the current position of the line in the table). The index values \u200b\u200bbegin with scratch.

Methods for adding new values \u200b\u200bto this collection exist practically from any universal collection. The figure shows how to fill the array with values \u200b\u200bfrom 0 to 10 in two ways.

In order to add an element to an array we can use the method Add, Specify the value added in brackets. The value will be added to the end of the list, i.e. The array will constantly increase due to the last position.

Another method that allows you to add values \u200b\u200bto the collection - method Insert. It differs from the method Addwhat you can specify which place you need to insert the added element.

Syntax: Insert (,)

The first parameter indicates the index in which the new value will be inserted. Those. We, for example, we can specify that each value needs to be inserted into the beginning of the list (the second method in the figure above).

To remove elements from the collection, the method is used Delete. In the Delete method, it is indicated by the index, which element we will delete.

Syntax: Remove ()
Example of use: NashMassiv. Delete (5);

It should be noted that for those collections where lines represent an independent entity (for example, for Tables), We can also use the index method in order to then delete this string.

Almost all collections have a value of the value of the value - To find. The method is transmitted to the value that we want to find. In some collections you can put any restrictions.

For example, in Table Zaviewyyou can specify those lines, those columns in which you want to search.

If the value is found, this method returns an index or a specific string. If the value is not found, the value of the type is returned. Undefined. Applied to the array returns Indexor value Undefined.

Example of use: Single-earth \u003d Nashimassiv.Night (8);

Universal collections can be cleaned very quickly, i.e. Delete absolutely all items. This uses method Clear ()which removes the elements of the array, strings Tablesor other collections data.

Additional methods for array

Method Vurban Returns the number of elements minus one. Those. if we use cycle For, instead of the method, we can immediately use the method The border().

In particular, the variable of the number of Massive could be determined otherwise:

Quantity Massive \u003d Nashimassiv.V.VGRAI ();
Then, when describing the cycle itself, one should not be taken from this variable.

Method Install allows you to assign a value to an array in the index.

Syntax: Establish (,)

Example: NashMassiv.Shorestall (2.8);

Alternative option: NashMassiv \u003d 8;

You can use the method for the array ReceiveIn order to read the value of the index without referring to the use of square brackets.

Syntax: Receive()

Example: Single-inxisted \u003d Nashimassiv. Pour (2);

Alternative option: Single-inxisted \u003d disabled;

Universal Collection Structure

Structure, as well as an array, may have an unlimited number of elements, but the content of the element is different from the array.

The structure is a collection, each value of which consists of a pair. The first element of the pair is called Key. The second element of the pair - Value.

Key- This is a strictly string type of data that describes the value. For example, Key"Code" may correspond to the value 113; Key"Name" value "Vasya". The value of the Data type restriction is not overlapped.

The structure is very convenient to use if we want to create a certain list of parameters. If this Structurecalled Outframe, then turn to her two values \u200b\u200bwe will in the following way: Outstaffing. Code and Outstanding.

Such an appeal is much more convenient than if all the parameters were determined in the array and turned to them on the index.

The structure makes the program code readable (understandable). The structure is used quite often, much more often than an array.

It is used to describe some parameters, which often there is a sufficiently large amount in all algorithms.

In addition, the structure is applied if the procedure and function contain a large number of transmitted parameters.

Then it is much more convenient to record all the parameters in the structure and it is it and transmitting it. Those. "Packaging" parameters of procedures and functions occurs.

Separately, it should be noted that as Keyin the structure there may not be absolutely any string. Conducted certain limitations.

Keymust act as an identifier. This means that in Keythere should be no gaps and it cannot start with the numbers.

Permissible Key With letter or underscore. In this way, Keymust meet the requirements for creating identifiers.

Note, the more embroidered differs from the array. In the structure there is a method InsertIn the array there are two methods for insertion: Insert(in a certain position) and Add(at the end of the list). In the array, all elements are ordered.

The structure is a kind of disordered set. That is why for the structure there is only the insertion method.

The value is inserted not at a specific position, but to the specified set. For the structure, an index appeal is unacceptable for other universal collections.

The structural elements are also referred to by the key named. However, the cycle for each of the work and for the structure, but it should not be relying on the order of the structural elements.

The structure is created in the same way as other universal collections by using the new designer, specifying the data type structure.

Like an array, the structure constructor may have parameters. Those. It is possible to describe the structure of the structure itself using the constructor.

Unlike an array where you can simply specify the number of items for all dimensions, in the structure it is possible to set the content itself.

For example: Outstanding \u003d New Structure ("code, name", 133, "Vasya");

Over the comma, first the names of the keys are listed, and then, accordingly, in the same sequence of parameters.

To add to the structure of the new value there is a method Insertthat inserts new couple (Key and value).

For example: Outstaffing. To hold ("membership", 3);

For the structure, another method is characterized, which is used quite often. This is a method Property.

With this method, you can understand, and whether there is such an element in this structure in which the key has such a name.

If there is such an element, the system will return the value of truth, otherwise - a lie.

For example, expression Outstaffing. Software ("Membership") It will be equal to the value of truth. This method is used quite often when analyzing the structure.

As for any universal collection, it is permissible to appeal to the properties of the structure by index. But the index for the structure is a string value.

For example: Notify (Outstanding ["Membersview"]);

However, you should not forget that the structure is not an ordered set of objects, which is why the appeal to the index 0, 1, 2 is unacceptable.

Universal Collection List of Values

Slip listit is a linear list of elements of any type of data.

Each element consists of several values. Schematically, the list of values \u200b\u200bcan be represented as a list with four columns.

First column - Mark. It has a Boolean data type and allows the user or place the checkboxes, or to shoot them.

Another column is a picture that can somehow visually depict this element. Put in compliance with this line any picture.

The third column is the self-stored value itself, i.e. This is any type of data, and in different lines it may be different.

The fourth column is a representation, i.e. This is a certain string description of this value. The view will be displayed when it will view this item. At the same time, if the representation is not specified, the system will try to get presentations for the element contained in this position.

Slip list- This is the object with which the user can visually work. Those. Slip listcan be displayed.

The user can perform some action with it. Besides, Slip listcan be output independently using methods, i.e. Show on the screen in some branch of the algorithm (with the exception of the server code) so that the user selects some kind of line or put any checkboxes.

Find Slip listin the Saintax Assistant. Constructor ListAssingnot parameterized (you cannot specify some default values).

There are methods such as:

  • Insert (,);
  • Add ();
  • Number();
  • Index().

There are special methods, for example, Unloading (). This creates an array that copies the list of values. For example:

Massivelements \u003d Listattzen. Video information ();

There is also a reverse method:
List Pipovets.Alipputs (massive elements);

There are search methods:
Found content (); Find Point Attitor ().

There is a copy method:
Copy Scripture \u003d ListTipovence .Copy ();
This method Designed to make some kind of modification with a copy.

There are methods:
Sorting ();
Sortpopserts ().

Methods Choose element (,)and Mixlements ()call a modal dialog box that stops the execution of the algorithm until the user closes this window.

To use these methods in configuration properties Mode of use of modality must be set to value Use.

An example of a code called from the controlled application module:

Displays this code in user mode (modal dialog box).

Below Slip listused as an affordable data type for the details of the form. Create for formation form new requisite, define the type for it Slip listand displays it on the form.

Create a new team WindowPodarks, We transfer to the form and determine the action handler for it.

In user mode, when you click in the form of processing a button, fill gifts, the completed list will appear.

If desired, you can edit the list: some elements add, some - delete.

Universal Collection Compliance

This collection is very similar to Structure. Also, like the structure, the correspondence is sets of values \u200b\u200bthat consist of a key and the very meaning.

The main difference is that any type of data may be indicated as a key as for the value. In view of this particular, it is necessary to refer to the conformity value by index, the value of the key is specified as the value of the index.

As a key, there may be a data type different from the string. Properties and methods of working with the correspondence are practically the same as the structure.

Conformity constructor, in contrast to the structure, does not contain the ability to specify the parameters.

Example of use:

Compliance is conveniently used when you need to associate any two structures. For example, each line of the tabular part must be mapping a string from the values \u200b\u200btable.
In this case, a string of the table part is used as a conform key and the corresponding value is specified.

When inserting elements to the collection, in addition to the method Insert (,) There is another way to insert the value - this is the use of a conventional assignment operator.

For example: Issues correspondence \u003d new compliance;
Compliance \u003d 999;

Those. If the element in the collection was not present, it will be added using the assignment statement, and if present, it will be updated.

This is the difference from the structure.

Universal Collection Table Values

Tablesit is a table with an arbitrary number of rows and an arbitrary number of columns. At the intersection, the values \u200b\u200bof any type of data can be stored. If necessary, the column can be typed, i.e. determine in which column which type of data is stored.

You can leave the speakers inepitis, then in one column in different lines values \u200b\u200bcan be stored different types.

Difference Tablesfrom a two-dimensional array:

  • this object with which the user can operate (the table of values \u200b\u200bcan be displayed, the user can fill it in the future, the entered data can be read);
  • construction of indexes for quick search;
  • cloning, filling in a certain value of the entire column, unloading all columns into an array.

Tablesused as a certain storage buffer. Tablesreturns and accepted as a parameter by many system methods. To the table of values \u200b\u200bit is possible to build a query.

So, Tablesconsists of a set of rows and a set of columns. Both lines and columns are collections.

Those. Inside the collection Tablesthere are two more collections. Refer to the syntax assistant and find Tables Satiments.

Supported data types: herself Tableswhich consists of lines. Each line is represented by the data type Strfotableswhich has its own properties and its methods. Available Collection COLOs Tablesalso possesses certain properties.

Important moment! The procedure that forms Tables Satiments, MUST COMPLIATED & NASTER.

Before start working with TablementIt is necessary to determine which columns will be contained in it (i.e., create them). Syntax:

Add ()
(optional)
Type: Row.
(optional)
Type: Description
(optional)
Type: Row.
(optional)
Type: number.

For example:

To call this procedure, we will use the command.

In description Tablesas elements of the collection, it is RipTablitsy.

Unlike columns that consist only of properties (name, type, title, width), in Railbreadlessnessthere are both properties (contact by the name of the column) and methods (you can receive and set the value to work with the owners).

To add new string The table needs to use the method or Add ()either Insert (). In the second case, you should specify which position you need to set the desired string.

To assign the value of the column, we appeal through the point by the name of the column or by the index (using square brackets).

For filling Tablesthe following methods can be used:

Clear () - to remove all lines from Tables.

Filling out (,) - Allows you to fill all columns or selected columns with one value.
ZagoColonka (,) - Loads the column from the array.
Unloading () - Unloads the column in the array.

The last two methods are convenient to use when you need to transfer the column from one table of values \u200b\u200bto another.

Copy (,) - allows on the basis of an existing table to create a new Tables SatimentsAt the same time specify not all rows and all speakers, but only some of them. Return value - Tables.

You can copy the structure Tables. There is a corresponding method for this. Copying collections (). We will get empty Tables Satiments with the required structure.

IN Table Zaviewythere is a method Outcome (). You can specify the column in which numeric values \u200b\u200bshould be summed up. In relation to the previously shown code in the scoreboard, you can calculate the value: TZ.ITOG ("Amount").

IN Table Zaviewythere is an opportunity to group (collapse) numeric values \u200b\u200bby the same values \u200b\u200bof certain columns using the method Collapse (,).

In relation to the previously shown code in the scoreboard, you can calculate the value: TZ. SWITCH ("DRINNED", "SUMM").

Tables Satimentsyou can show on the user screen so that any actions can be performed with it. But unlike ListAssingfrom the program code it is impossible to simply call the table on the screen.

To display Tables Satimentson the screen, create a form props and assign it a data type Tables.

After that, the resulting table should be displayed.

In the module of the form at the end of the previously composed algorithm (in the procedure for creating the conventions) should be added:
Meaningrendanephors (TK, table);

Universal Collection Tree Values

universal collection, which is very similar to Tables Satiments. The difference from the table is that tree strings can be subordinate to each other, i.e. A certain hierarchy can be formed.

Also can also be reflected on the screen. The tree of values \u200b\u200bexplicitly consists of a collection of rows and columns collection. In the tree there are such two properties as strings and columns.

Since the lines can be subordinate to each other, the parent can be specified for each line, as well as the strokes subordinate to it.

Create the appropriate tree command and its processing procedure.

Create in which one parent line and two subordinates.

Create the requisite of the form DRENN(data type - ware).

For this details, create columns year and month.

Move the corresponding item DRENNon the form.

In the end Procedures Woodersserver () I add:

Meaningrendanephors (coarse, DREND);

Check what happened in user mode.

Use the button Addyou can add new lines. They can also form a hierarchy.

To get around all the elements of the tree of values, we will need to use recursion, i.e. Challenge the procedure itself. For example, tree processing of values \u200b\u200bmay look like this:

On this we are completing our first acquaintance with universal collections.

In the next article, we consider using which important mechanism the developer can simplify the reference to the directory from the program code.

Full syntax (click to disclose)

Slip list

Description:

The list of values \u200b\u200bis the object that is not saved in the database that allows you to build dynamic sets of values \u200b\u200bfor solving interface tasks and manipulate them (add, edit, delete elements, sort). It can be filled with values \u200b\u200bof any type, i.e. In one list, the types of stored values \u200b\u200bmay be different. One example of using this object can be the organization of choosing a specific document from the list possible documentsformed by complex algorithm.

Collection elements: ElementSPCDs

For the facility is available bypass collection by operator For everyone ... from ... cycle. When traversery, elements of the collection are selected.

It is possible to appeal to the collection element by operator [...]. The element index is transmitted as an argument ( numbering from 0.).

Properties:

Methods:

Insert (index, value, performance, mark, picture) inserts new element In the list of values \u200b\u200bto a position with the specified index.Select element (header, item) calls a window for an interactive selection of one of the items included in the list of values. Element - The element to which initially socose a list of values \u200b\u200bduring an interactive choice should be originally. If the value of the parameter is not the list of values \u200b\u200bincluded in this list, positioning will not occur.Unloading() Creates an array and copies the values \u200b\u200bof the values \u200b\u200blist items.Add (Value, View, Mark, Picture) Adds a new element to the end of the list of values.Download(Massive) loads the list of values \u200b\u200bwith the values \u200b\u200bof the transmitted array. At the same time, all previous elements of the list are deleted.Film player(Mark) Sets the mark from all elements of the list of values.The index (element) receives an element index in the list of values. If not found, then returns -1.The number () receives the number of values \u200b\u200blist items.Found content(Iscomed) Searches for the value of the list of values \u200b\u200bitem. If no item stores the value equal to the desired, then the value is returned. Undefined. Foundationant(Identifier) \u200b\u200bGets an item of the list of values \u200b\u200bby identifier. If the item is not found, then returns Undefined. Mental elements(Title) Sets or removes (interactively) marked from the values \u200b\u200blist items. Returns Trueif the "OK" button is pressed in the dialog False - otherwise.Clear () Clears the list of values \u200b\u200bby removing all items from it.Shone element(Description Enterprise, header, element) Causes a window for an interactive selection of one of the elements included in the list of values.View set tolements(Description Enterprise, header) is intended for interactive setting status marks from the elements of the list of values.Get (index) gets the value of the index. Works similarly to the operator.Shift (element, offset) shifts the list of values \u200b\u200bto the specified number of positions forward or backward.Copy () creates a copy of the list of values.Sortictive(Direction) Sorts a list of values \u200b\u200bin ascending order or descending by stored elements of values. See Example below.Sortpopsert.(Direction) Sorts a list of values \u200b\u200bascending or descending in the alphabetical manner of submissions of the list of elements included in the list. See Example below.Delete (element) deletes an item from the list of values \u200b\u200bwhere Element - index of the removed item, or the element itself.

Designers:

New list of accommodation
& Caltente Procedure PerformCode (Team) /// How to create a list of values \u200b\u200bin 1C 8.3, 8.2 List \u003d new list of accommodation; /// How to add an item to the list of values \u200b\u200bin 1C 8.3, 8.2 // Method Parameters Add: // - Value // - representation // - Mark (optional) // - picture (optional) List. Add (1980, // Value element "Year of birth Vasi" // representation ) ; List. Add (1985, "Year of birth of Julia") ; // values \u200b\u200bcan be different types List. Add ("Polina", "Baby Name"); /// How to insert an item in the list of values \u200b\u200bin 1C 8.3, 8.2 // Insert into position number 2 (items are numbered from 0) // Element with the 2010 value and representation // "Year of birth of their joint daughter" List. Insert (2, 2010, "The year of birth of their joint daughter") ; /// How to bypass the elements of the list of values \u200b\u200bin 1C 8.3, 8.2 For each element from the loop list, report (element. View + ":" + string (element. Value)); EndCycle; /// How to Clean List of Values \u200b\u200bin 1C 8.3, 8.2 List. Clear (); List. Add (Monday); List. Add ("Tuesday"); List. Add ("Wednesday"); /// How to find out the number of items of the list of values, as well as /// Get an element of the list by its index in 1C 8.3, 8.2 // Numbering from scratch For index \u003d 0 on the list. Quantity () - 1 cycle Report (list [index]); EndCycle; /// How to find an element of the list by its value in 1C 8.3, 8.2 Valorist \u003d list. Found content (Tuesday); /// How to find out the index of the element in the list in 1C 8.3, 8.2 Report (List. Index (Signalist)); // 1, as the numbering from scratch /// How to sort the list by its values \u200b\u200bin 1C 8.3, 8.2 // was: Monday, Tuesday, Wednesday List. Sorting (directions. Decession); // Stable: Wednesday, Monday, Tuesday /// How to delete an item from the list of values \u200b\u200bin 1C 8.3, 8.2 // Remove the first element // Parameter: List Element // or element index // You can so a list. Delete (list [0]); // or so // list. Delete (0); /// How to shift the list of values \u200b\u200bin 1C 8.3, 8.2 // We shift the zero element for one position forward // was: Monday Tuesday List. Shift (0, 1); // Stably: Tuesday Monday /// How to make a copy of the list in 1C 8 Copy Scripture \u003d List. Copy (); Colors \u003d new list of accommodation; Colors. Add ("red"); Colors. Add ("green"); Colors. Add ("blue"); /// How to unload the list values \u200b\u200bin an array in 1C 8.3, 8.2 Massivecets \u003d colors. Unloading (); /// How to upload the values \u200b\u200bof the list from the array in 1C 8.3, 8.2 Colors. Downloads (mass arms); Extrudresses /// How to make a formal choice of value from the list /// Values \u200b\u200bin 1C 8.3, 8.2 & Clause procedure Assessing the alignment) of color \u003d new list of output; Colors. Add ("red"); Colors. Add ("green"); Colors. Add ("blue"); // Postwear procedure is defined just below AlertsLabelectable element \u003d new description computer ( "Postwar element", This object); Colors. Shone element (notification of lightbreaker, "Choose your favorite color" ); End Controlments & Communication Postwar Element Procedure (Element, Parameters) Export If the Element<> Uncertain then to report (item. Value); Ended; Extrudresses /// How to make a non-modal mark of values \u200b\u200bfrom the list /// Values \u200b\u200bin 1C 8.3, 8.2 & Clause Procedure Assess the alternate notebook (command) color \u003d new list of accommodation; Colors. Add ("red"); Colors. Add ("green"); Colors. Add ("blue"); // The post note procedure is defined slightly below RecordsMelectsmethelements \u003d New Description ( "PastaMelements", This object); Colors. Showcase elements (notifying elements, elements, "Choose your favorite colors" ); Colors. Fuelings (truth); End Controlments & Complaint Procedure Preparations Elements (Elements, Parameters) Export If Elements<> It is uncertain then for each color from the elements of the cycle if color. Mark then report (color. Value); Ended; EndCycle; Ended; Extrudresses /// How to make a modal choice of value from the list in 1C 8.3, 8.2 & Clause Procedure AssessingModal Education (Team) Colors \u003d New Snaps; Colors. Add ("red"); Colors. Add ("green"); Colors. Add ("blue"); Welcome \u003d colors. Select element ( "Choose your favorite color"); If chinvat<> It is uncertain then to report (WILL. VALUE); Ended; Extrudresses /// How to make a modal mark of values \u200b\u200bfrom the list /// Values \u200b\u200bin 1C 8.3, 8.2 & Clause Procedure As far asomodalTextooms (command) color \u003d new list of accommodation; Colors. Add ("red"); Colors. Add ("green"); Colors. Add ("blue"); If colors. Character elements ( "Choose your favorite colors") Then for each color from the color cycle if color. Mark then report (color. Value); Ended; EndCycle; Ended; // And so you can install all marks // List to a certain meaning Colors. Fuelings (truth); Extrudresses /// download and execute these examples on the computer

In this uniform we will get acquainted with the new type of data of Language 1C, which is called SPAYLOVIES.

List of values - this is an array, but with greater possibilities. And if so, it is also a collection of data and you can put a set of numbers in it:

// created a list of values

List. Add (23);

While everything is very similar to an array, isn't it? But go further. To bring these numbers to now, write:

// We run through the cycle for each element of the list for each item from the list of the Cycle Report (Element. Relationship);

// Display the value of the element of the endCycle;

And the first difference. Elements of the usual array are the numbers themselves. And access to the current value of the element List we get using the option Valueusing the design Element. Value.

Consider some extra opportunities / Sia Values.

Able to sort

For example, we can easily sort the list of values. The list is able to do it:

List. Sort-thewareness (directional separation. In the case of a conventional array, we would have to implement one of the sorting algorithms (for example, "bubble").

Know how to find

The list of values \u200b\u200bcan seem to look for its elements. Let we want to find out if the user entered by the user is on our list:

Introduced (number); // Entered the number from the user found element \u003d list. Found content (number);

If the element is ilem \u003d is uncertain then the open-outset ("Number" + number + "not found in the list!"); Otherwise

Open-analyzing ("The number" + number + "is present in the list. Here it is:" + Found Element. Designation);

Ended; Slip list

Supports insert and removal

List of values, as well as an array, supports insertion and removal of items:

List. Insert (0, 1000);

// Insert a thousand to the very beginning of the list list. Delete (o); // And immediately delete it from the list list. Insert (list. Nality (), 13);

// Insert 13 at the end of the list to report (list [list. Nality () - 1]);

// Display the last element of the list (13)

Supports square brackets

As you already understood, the numbering of the list elements is also from scratch, and we can refer to any element on its index using square brackets:

Report (list. Relationship); // brought the second element of the list so we can run over all elements of the list also so:

For a \u003d 0 by list. Number () - 1 cycle Report (list [A]. Relationship);

EndCycle;

Knows how to create a copy

The list of values \u200b\u200bis simply a gorgeous opportunity - he knows how to create his copy himself:

Copy description \u003d list. Copy ();

// Made a copy of the list // Now we can safely change the copy space // In this case, the source list will not change the copy. Value \u003d 123456;

Knows how to turn into an array

And finally, you can easily unload all the elements of the list to the array at any time:

Massigated \u003d list. Unloading ();

// unloaded into an array

For a \u003d 0 by massive. Racing () - 1 cycle

Report (arigised [a]); // No need to specify // Option Value

EndCycle;

To work out and securing the material of this unit, it is recommended to perform the following task.

You must enter from the user 5 numbers, find the largest and smallest of them and bring them to the user. The solution should use a list of values.

Decision

List \u003d new list of accommodation;

// created a list of values \u200b\u200bfor a \u003d 1 to 5 cycle number \u003d 0;

Introduced (number); // Enter the number from the user list. Add (number); // and add it to the list of the designer; // and so 5 times

// Let's sort the list of numbers

List. Sort acquaintance (directions. WIS);

// After sorting the first element of the list - this is // the smallest element, and the latter is the largest opening ("The smallest element" + list +

", and the biggest" + list [list. Nality () - 1]);