the Internet Windows Android

Primitive type Buleveo. Primitive type Boolevo What does it mean in 1C type boolevo

This article continues the cycle of articles "First Steps in Development for 1C". It will talk about primitive data types and the most common features when working with them. After reading the material, you will learn:

  • What data types are primitive?
  • How can you work with rows and what features should be considered?
  • What are the subtleties of work with numerical expressions?
  • How to describe a specific value? How to set an empty date?
  • How does the type conversion work?
  • NULL and vague - what is it and what is the difference?
  • How to determine which type of object / variable?

Applicability

The article is written for the 1C version 8.3.496 platform, so the information is relevant for the current version of the platform. However, it should be noted that in version 8.3.6.1977 new features of working with rows were added. Therefore, when you repeat actions from the article, do not be surprised if you will see some functions that are not shown in the screenshot in the appropriate section of the assistant syntax. We also recommend you to familiarize yourself with the new method of stringChange (), added in Platform 8.3.10.

Primitive data types and some of their functions

Allocate the following primitive types of data:

String constants

Primitive data type Line(rowing constant) consists of different characters. Linealways framed by quotes. Example of a string constant:

Message. Text \u003d "There are empty data";

Those. The line "present empty data" is assigned to the details Textobject Message. All that is framed in quotes is considered a string.

The string may consist of any characters. Rows can be multi-line. In this case, each new line needs to be determined in quotes. For example:

Text \u003d "incorrectly filled props"
"Conducting a document is impossible";

The point with the comma is placed only at the end of the last line.

There is another way - the whole text is framed only in some quotes, but each new line Should begin with a vertical strip.

This syntax is most often used in typical configurations. In particular, in the query language. For example:

Request.text \u003d.
"CHOOSE
| Employees. Name as an employee,
| Employees. Advantages like dadinary
| Is
| Directory. Schedures as employees
| Where
| Non-employees.Tehogroup ";

It should be noted that the operation is defined for the rows. This is not an arithmetic operation, it is called a concatenation operation.

Those. You need to combine, for example, two lines, while between the rows is the sign of addition "+":

Text \u003d "Incorrectly filled requests" + "the document is impossible";

Thus, rows gluing. Concatentation operation, naturally, applies to more lines. Other operations (subtraction, multiplication, division) for lines are not allowed.

If there is some word inside the string, you need to framed in quotes, then the quotion inside the line needs to be determined double quotes. For example:

Text \u003d "Error in the module" "Common module1" "";

IN this example The first quotation over the string opens. Near the standing second and third quotes indicate the quotes sign.

And at the end, three quotes are obtained: the latest quotion closes the string, the two previously denotes quotes sign.

Various row conversion operations are possible above the rows, defining the few first left characters, the definition of several extreme right characters, search for substring inside the string, etc.

All these features are available anywhere in the configuration.

In the Syntax Assistant they are in the section General description of the embedded languageBuilt-in functionsWork functions with values.

Functions are enough a large number of And they are usually enough to work with string constants.

We will analyze an example of solving the problem using string functions.

The task:

It is required to develop a function. An arbitrary string is transmitted as a parameter to the function. Symbols in the string can be including numbers.

The sequence of numbers (from one or more), limited from other signs of spaces, is a positive number.

For example, the string "72 ABC 6AP 31 54F -22" contains two integer positive numbers: 72 and 31. In addition to gaps, other inconcent characters (such as tabulation, carriage returns) are not used. The function must return the number of entire positive numbers.

It should be placed in the managed application module. It is necessary to ensure its call when starting the system. Determine the string using a variable.

So, we will open the controlled application module and select the selection field from the list in the configurator panel Modulestandard handler PropaculatorySystems ().

Inside the handler will determine the variable Line, eg:

Row \u003d "72 ABC 6AP 31 54F -22";

Quantity \u003d Ringing (string);

We will issue a message about the number of integers:

Report ("The string contains" + quantity + "integers");

In this case, the variable number will be implicitly converted to type String constant. Then a concatenation operation will be performed for three lines and a message is transmitted.

We define the beginning and the end (i.e. template) functions Ringing (string).

Now consider one of the possible options for developing a function. Ringing (string). In this case, we will get acquainted with some built-in features designed to work with lines.

First of all, you should get acquainted with the function Kodsimvol.. This feature receives a symbol code located in the transmitted row in the position with the specified number.

Syntax:

Codeimvol (,)

Parameters:

(mandatory)

(Optional) is a character number in a string whose code must be obtained. The numbering of characters in the string begins with 1.

Return value:
The code of the transmitted symbol. The code returns in accordance with Unicode encoding.

Note that the parameter There is a default value of 1.

The string can also consist of one symbol. Thus, it is possible to determine the code 0 and code 9, and the codes of all other numbers are located, as you know, in the interval between them.

We define the appropriate variables and their values:

Code 0 \u003d codeimvol ("0");
Code9 \u003d codeimvol ("9");

To solve the task, choose the following scheme:

  1. If the starting or final gaps in any quantity are present in the line, then you will get rid of them with a special function. Next we will be interested in groups of characters between internal spaces. If the group consists of some numbers, then this is an integer. There is a special function with which you can determine the position of the first space.
  2. Having received the position of the first space, using another function you can get a group of characters (substring) to the left of the space.
  3. We analyze the characters that make up the group and define: whether it is an integer. The identified integers will summarize in a special variable.
  4. Root the starting line by selecting with another function all the characters now to the right of the space. This gap could not be alone, but a whole series of gaps, going in a row, therefore, in the remaining line, a special function will get rid of all extreme left gaps (going in a row) and return to paragraph 2. We will repeat the actions from paragraph 2 to paragraph 4 until we reach The states that there will be no spaces in the string. In this case, the shortened string will be the last group of analyzed characters.

Now we will analyze the functions that we need to solve the problem.

SokrLP
Syntax: SokrLP ()
Parameters: (mandatory).
Cuts off spaces (insignificant characters), which are located on the left of the first character symbol in the row, and standing to the right of the last sign symbol in the row.

To find
Syntax: Find (,)
Parameters: (mandatory), (mandatory).
Returns the position of the first sign found substring.
The numbering of characters in the string begins with 1. If the string does not contain the specified substring, then 0 is returned. In our case, we will use a space as a substring ("").

a lion
Syntax: Lion (,)
Parameters: (mandatory), (mandatory).
Selects the first left string symbols. With this feature, we will define characters for analysis (left to first space).

Strotina
Syntax: Strotina ()
Parameters: (mandatory).
Gets the number of characters in the string. We will use to determine the length of the string.
Function Kodsimvol.which will be used to identify groups of characters that are integers, described earlier.

Right
Syntax: Rights (,)
Parameters: (mandatory), (mandatory).
Selects the extreme right of the string symbols. Using this feature, we will allocate a raw row part.

Sokrel
Syntax: Sokrel ()
Parameters: (mandatory).
Spaces gaps (insignificant characters), standing from the left of the first meaningful symbol in the row. We use this feature to remove possible spaces to the left of the remaining part of the line.

Below is a possible algorithm of features with comments.

Numerical expressions

Numeric can be variable modules and details of the database objects.
For the number there is a limitation of bit. For numerical props, the length of the whole part cannot exceed 32 characters.

The accuracy of the fractional part cannot exceed 10 digits. When the variable is described and the numeric value is assigned to it, then nowhere is its discharge. However, for variables also there are limitations.

The assistant syntax says that the maximum permissible bit rate for the number is 38 characters. Such a limitation does not interfere with the solution of any economic tasks, i.e. Any money can be described with these numbers.

However, if it will still need to describe large values \u200b\u200bto solve some mathematical tasks, then in programming theory there are algorithms that allow you to describe numbers with any dimension based on existing restrictions.

Operations applicable for numbers:

  • conventional arithmetic operations (-, +, *, /). Multiplication and division has more priority than addition and subtraction. Brackets have the highest priority. There are still unary operations + and - whose priority goes immediately behind the brackets;
  • operation "Residue from division" (%). For example, 12% 5 \u003d 2;
  • mathematical functions that can be used for numbers (trigonometric functions, the construction of the square root, rounding to the specified bit, select the whole part of the number)

If we talk about the accuracy of numerical values, as for the database details, there are natural limitations here.

But as for variables, there is a feature. In fact, in variables can be operated on very large numbers, but in the information base, values \u200b\u200bwith a length of the whole part are not more than 32 characters.

Boolean values

As for the type of Buleveo data, there are only two values \u200b\u200bof truth and lies that can be obtained. different ways.

You can, for example, use the comparison operations of numbers or dates. As a result, some boolean meaning will be obtained, which is in the future most often used in conditional operators and in the cycle operators.

Date type literals

To describe the date there are two ways. One of them using literals. Literal is written in single quotes.

First spell a year, then a month and then day.

If necessary, you can specify the time, because In the 1C system: Enterprise 8 Any date contains the date and time. For example:

Data dock \u003d '20140315121020';

If the time is not specified, then by default it is zero. In the date description, you can use any separator. For example:

Datadociation \u003d '2014.03.15';

The second way to determine the date is to use the function of the global context Date(). In this case, we transmit this function as the parameters the same thing: year, month, day after comma.

You can also specify time. If it does not specify it, then it will be the default day of the day.

In System 1C: Enterprise 8 An empty date is the very beginning of the calendar. Record options:

Damned \u003d '00010101';
Damned \u003d date (1,1,1);

And the same entry will return the same result, and this date will be considered empty.

Convenience of function Date() In that we can transmit to it not specific values, but some variables. Those., Sometimes we design the date by collecting different variables.

For the date the operation is applied. The addition operation adds to the date of the specified number of seconds.

Converting Primitive Data Types

In the assignment statement, where several variables are summed (for example, Variable \u003d a + in + with) It is possible to convert primitive data types. Data type conversion is carried out by the value of the first data type.

Thus, if the first data type is a string, then the system will try to make a string from all this expression. If the first data type is the number, then, accordingly, the system will try to obtain a numeric data type.

And so, line + number \u003d string. Sometimes the number can be folded with a string, if some numeric value can be isolated from the string (for example, 123 + "456").

For logical data type applicable expressions:

Truth and 1 \u003d truth;
Truth and 0 \u003d lies.

Any number of zero is transformed into truth, 0 is converted to a lie.

The date you can, as noted before, folding with a number. The date can also be folded with a Boolean data type.

In this case, the truth is converted to 1, and a lie in 0.

In addition to converting types in operators, there is a clear conversion of types using the corresponding functions: Row (), number (), date (), booleo ().

TO Stringany data type is converted.

The number can be obtained from a row or from Boolevo. Boolevo is converted: truth in 1, lies in 0.

By date, you can cite a string if there will be a date value. For example, the date ("20140315"). As noted earlier, conversion is possible by positions:

Date(,).

In Boolean, you can convert the number and the value of Boolean.

These functions can be used in the program code in order to perform an explicit type conversion.

Primitive data types Number, string, date and boolean can act as database fields.

Null values \u200b\u200band uncertain

NULL is a literal. It is used, as a rule, in the database queries when two or more tables are connected.

It is missing records in the second table and are filled with a value of type NULL. Those. This is some missing value.

In the future, when processing the resulting result, this must be taken into account, since NULL is not zero, but the corresponding data type.

In order to treat, NULL need to lead to any ordinary type Data that can be output or used in arithmetic operations.

The value of the NULL type can be obtained in the embedded language. You can define some variable and assign it the value of NULL. However, this assignment in the program code is almost never used.

Those. NULL is indeed the type of data that is obtained when working with requests. The NULL value in the query language needs to be worked out differently.

Namely, at the query level there will be no comparison A \u003d NULL, you will need to use specialized functions. However, in the embedded language, the comparison with the value of NULL will be correctly worked out.

The data type is undefined - this is not an empty value of any details.

For example, if the recording of the reference book has a link to any other directory as a data type, then the empty value of this props will not be equally uncertain.

This type (Uncertain) appears, firstly, if we have a certain variable and it does not initialize (the data type is not defined).

The second example: the data type is indefinitely returned by many embedded language functions if the action cannot be executed.

For example, searching an item of the reference to the name in the event that any reference book does not have this name of the item. Method Foundation will return the value Undefined.

Wherein Undefined It is keyword, it is highlighted in red. This is also a literal for writing Undefined No need to use any quotes, commas, brackets, etc.

If there is a list of documents, and this list is empty (in it, there is no string, respectively), then current string will take value Undefined.

If in information base There is requisite with a composite data type, then the empty value of this props will be equal Undefined.

But if the data type is not composited, then the empty value will correspond to the empty value of this type (for the date is the first second of the first hour of the first day of the first year).

NULL and uncertain - these are the types of data and values \u200b\u200bin these types, and one one. For NULL, this is NULL, for uncertain - indefinitely.

Type data type

The main application of this data type is to compare the value of a certain variable or database details with a specific type.

Those. The algorithm needs to understand what type of this object.

It is noteworthy that this type of data has no literal. We can not write it, such as null or uncertain, but we can get the meaning of this type with two functions A typeand Typny.

In order to get a type of some object (it can be a variable or database props, or the form props), a function is used Typny.

This object is transmitted to this function you want to get a data type.

As a returned value, this function returns exactly type type.

In the future, it should be compared with any object of interest. For example:

If typny (element) \u003d type ("DANDERTANDER SHIPTURE. NOMENCULTURE") then
Report ("This is the goods");
Ended;

In conclusion, let's summarize the entire covered material.

We looked at the basic design of the built-in 1C language, learned how to use variables and operators, figured out, for which and how to use procedures and functions. Note that mostly our entire program code before this moment was self-sufficient - we all wrote themselves from scratch and at a minimum used some configuration or built-in languages.

In the next article, we will study these objects in more detail, so do not switch! ;)

Hello, dear blog readers Site! Last time we paid attention to in the embedded language 1C: Enterprise 8. Today we will continue and talk immediately about two data type - Boolean and dateAnd also consider how to work with them. So, let's begin!

Concerning data type Booleo, everything is quite simple here. There are two meanings True and Falsewhich can be obtained in various ways. For example, you can use comparison operations:

  • 101\u003e 1001 equals False
  • 101 truth
  • '20000101' \u003d '20000102' equally False
  • 'Open "open" equals True

As you can see, you can use various comparison operations numbers, rows, dates. As a result, some boolean value will be obtained, which is often used in conditional operators and in the cycle operators.

Now consider primitive data type Date. To describe the data type date Usually two ways are used. The first, use of the literal. Let's declare a variable that will be called "Current Data". For example, it will be equal to October 2, 2014. In this case, the date format is used year / month / day.

Flowable \u003d "20141002"; // 02.10.2014

If there is a need, we can specify the time, because in the 1C system: Enterprise 8 any date contains within itself and the date and time. Therefore, if necessary, you can specify, for example, this time: 15 hours 5 minutes and 50 seconds. It will turn out a year / month / day / hour / minute / second.

Flowable \u003d '20141002150550'; // 02.10.2014 15:05:50

If you do not specify the time, then by default it will be zero, and the date can be described here in this way: '20141002'.
For clarity, any separator can be used, for example, points ".". Therefore, the date may look like this: '2014.10.02'. It was the first way to describe the date. Please note that single quotes are used, that is, a literal that cannot be broken. It is written in single quotes.

The second way to determine the date is the use of a global context function Date(). In this case, we transmit as the parameter of this function the same: year / month / day. Parameters here need to be specified through a comma.

Flowable \u003d date (2014, 10, 02); // 02.10.2014 00:00:00

You can also specify time.

Flowable \u003d date (2014, 10, 02, 15, 05, 50); // 02.10.2014 15:05:50

If time does not specify, then it will be equal to the beginning of the day. You can also write the following call to this feature:

Current) \u003d date ("20141002150550"); // 02.10.2014 15:05:50

It uses one parameters with a string that should contain date in format: year / month / day / hour / minute / second.

In order to describe an empty date in System 1C: Enterprise 8 needs to be done as follows:

Damned \u003d ""; // 01.01.0001 00:00:00

Or using the description through the literal:

Damned \u003d "00010101"; // 01.01.0001 00:00:00

Another way, using the global context function already familiar to us:

Empty date \u003d date (1, 1, 1); // 01.01.0001 00:00:00

The use of these methods will return the same result and the date will be considered empty. Convenience of function date It is that we can transmit here not specific values, but variables. Sometimes you need to get a date by collecting different variables. For this very well helps the function date.

And I also want to note that the operation is applicable for the date. If adding to the date number ten:

Flowable \u003d date (2014, 10, 02, 15, 05, 50); // 02.10.2014 15:05:50 flowing \u003d flowing + 10;

As a result, we will receive the date for ten seconds more:

02.10.2014 15:06:00

So, the addition operation adds to the specified date a certain amount of seconds. This is the difference from the version of the system 1C: Enterprise 7.7, where the number of days was added when folding the dates, and not seconds.

Many who are just starting to study programming, first faced with a new primitive type for themselves boolean. Still called him differently logical type . This type is named after the English Mathematics George Bul, who studied mathematical logic issues.

Before you start studying this primitive type, we learn at all what booleans or logical expressions are.

Boolean expressions is something like a question that should be unambiguous answer or yes, or not.

5 < 7 — Да;

5 \u003d 8 - no;

4\u003e 9 - no.

I can also be more complex questions:

The button is pressed - yes;

The button is pressed - no;

Boolean expressions are used in all conditional transitions:

If a< Булево выражение1> then

// Operators

Inaccession< Boolean meter2.\u003e then

// Operators

Ended;

In the programming language 1c variable with primitive type Boolean, you can explicitly set:

A \u003d truth;

B \u003d false;

Where the truth and lies are the only values \u200b\u200bthat the primitive type of Boolean can take.

The truth means that some statement is true (answer - yes).

Lies - mean that some statement, on the contrary, does not correspond to reality (the answer is).

Also variables with the type Boolean can be specified using any logical expression.
For example:

A \u003d 5.< 7 ;

B \u003d 6\u003e 9;

In this case, in a variable and there will be the value of the truth, and in a variable type b - false;

In the programming language 1c above variables type Boolevo can carry out various operations.

For example:

A \u003d 5.< 7 ;

B \u003d 6\u003e 9;

B \u003d a and b;

C \u003d a or b;

D \u003d not a;

Total three of them - and, or not.

The following tables will help to understand the functionality of these operations

Operation ne.

BUT B.
True False
False True

Operation I.

C \u003d a and b BUT B.
True True True
False False True
False True False
False False False

Operation or

C \u003d a or b BUT B.
True True True
True False True
True True False
False False False

Is it possible to perform these operations in a row?

Yes, you can, these operations will be performed from left to right. And have the following level of seniority:

First: First of all, operations are performed in brackets

Second: Operation is not

Third: Operation and

Fourth: Operation or.

In order not to be confused in operations, I advise you to use brackets, where only possible.

For example:

A \u003d false;

B \u003d truth;

C \u003d false;

D \u003d a and c or b;

In this case, the operation will first work ANDbetween A and C.

We look at the table A - False, FROM - False, result A. ANDC will False.

The next step will be the execution of the operation ORbetween Lie(Result of the previous operation) and the value of B, which True.

The result will be True.

And if we need to first pass the operation ORbetween C and B, and then only the operation ANDbetween a and what happened, it is necessary to use brackets.

A \u003d false;

B \u003d truth;

C \u003d false;

D \u003d a and (s or b);

The result will be diametrically opposed. Why? Now we will analyze. Thanks to brackets, the operation is first performed between C and B, because FROM - False, and b - True, the result will be True. Then between the value A (which False) and meaning True(the result of the previous operation) operations operation AND. The result will be False.

Many novice programmers do not completely fully understand the principles of interaction between the variables of the Buleveo type. Only practice can help. And practices with variable type bolevo enough in my task book to the book

Learn the basis of configuration in 1C and learn to program in "1C: Enterprise" with my books: and "Basics of development in 1C: Taxi"

Explore programming in 1C in place from my book "Program in 1C for 11 steps"

  1. The book is written by understandable and simple language - For beginner.
  2. Learn to understand the architecture of 1C;
  3. We will write code in 1C language;
  4. Light the main programming techniques;
  5. Secure the knowledge gained using the task;

Excellent development allowance in a managed application 1C, both for beginner developers and experienced programmers.

  1. Very affordable and understandable language of presentation
  2. The book is sent by email in pDF format. Can be opened on any device!
  3. You will understand the ideology of the managed application 1C
  4. Learn how to develop a managed application;
  5. Learn to develop controlled forms 1C;
  6. You can work with the main and necessary elements of controlled forms.
  7. Programming under a managed application will become understandable

Promo code for a discount of 15% - 48pvxheyu.


If you helped this lesson to solve some problem, I liked it or was useful, then you can support my project, listened to any amount:

you can pay manually:

Yandex.Money - 410012882996301
Web Money - R955262494655

Join my groups.

As a rule, the study of any programming language begins with an example of writing the first simplest program ("Hello World!"). This is done in order to visually show work with basic syntax designs. We will not make an exception to the generally accepted method of filing a material when studying a new development environment and therefore our first article should be considered in the same vein. In it in detail in detail the answers to the following questions regarding programming on the 1C: Enterprise 8 platform:

  • Where and with what to write program code in the built-in 1C language?
  • What software modulesWhat are the rules of work with them?
  • What is a variable, how to work with it, how and where to declare it?
  • What comparison operators, assignments and conditions exist and how to apply them?
  • Boolean operations - what is it and how to work with them?
  • Why do you need cycles and how to use them?

The article will be useful for all those who are not yet familiar with the development on the 1C: Enterprise 8 platform, but wants to learn to program for 1C.

Applicability

The material is relevant for the "1C: Enterprise 8" of the editions 8.2. and 8.3.

Variables and operators

In this article, we proceed to study the embedded language 1C: Enterprise 8. The executable code is contained in software modules.

There is a sufficiently large number of modules that are intended for processing various events.

So, the user's login is processed in one module, and handling the user's pressing for some button is completely different.

Thus, each module describes the configuration behavior at a specific point. The module contains, first of all, the variable description section. Those. We can declare some variables in the module.

In the future, they can be used in the procedures and functions of this module. If the variable is defined with the keyword export, it will be available outside this module. Example of variable announcement lines:

Warehouse, division, storekeeper exports;

After declaring variables, contains the procedures and functions.

For them is the section of the main program, which will be performed at the time of reference to this module.

For example, in the Main Program section, you can initialize variables, i.e. Assign them some initial values:

Condition \u003d 1;
Regeneration \u003d 2;
Result \u003d 3;

The module can be represented as a combination of various operators that perform different actions we need.

The separator of operators is the symbol ";" (semicolon). This sign is a sign of the end of the operator. Those. The operator can be recorded in this form:

Result \u003d 100x200
+400
-600;

It does not matter whether the operator is located on how many rows.

Of course, more often it is more convenient and clearing the operator in one line, but sometimes operators are long enough (the number of rows can reasonably reach several tens).

The point with the comma can not be placed in the final operator of this design, for example, procedures. Those. The following code will work:

Computing procedure ()

Output \u003d 100;
Intermediate \u003d initiation / 5;
Total Inclination \u003d Expanding + Intermediate

Extrudresses

However, it is better to use a comma point in the final operator. It is possible that over time the design will continue, and the final operator will be no longer final. We'll have to specifically track this situation.

Variables are designed to store some values \u200b\u200bof any data type. They are used to intermediate information storage, for processing.

Practically in any software module that performs some actions, there are various variables. Typification of variables by values \u200b\u200bin the 1C platform: Enterprise 8 soft.

For example, the variable may contain the value of one type of data, and after several rows - another type:

Created \u003d false;
Created \u003d truth;
Created \u003d 100;

In the first two operators, the value of Variables by Boolean, and in the third it changes to a numeric value. Those. Typification depends on the value that is assigned to this variable.
You can describe variables in two ways:

  • an implicit method (mentioning on the left side of the assignment operator describes this variable, there is no preliminary description of the variable with the word AG, i.e. there is no special section of the variable descriptions);
  • explicit description of variables (MC controlled;). An explicit description of variables is used, for example, if the subsequent transmission of this variable to the function is assumed.

For variable names, a classic identifier description is used. The identifier consists of letters, numbers and underscores. The identifier must begin either with the letter, or from the underscore.

In this case, the name of the variable should display the meaning of this variable. The names of variables from one letter (type A, B, C) are bad examples. They do not reflect the essence of variables.

Examples of the correct name of the variables: the counter (increasing variable for the cycle), counterparty. If the variable name contains several words, each new word, for clarity, should begin with a capital letter.

In the name of variables, it is impossible to use reserved words, such as the procedure, function, cycle, endackel, etc. (These designs are highlighted in a red-based software module).

Reserved words are the operators of the embedded language and their sufficiently small amount. All of them are presented in Syntax assistant.

It should be noted that the data types to reserved words are not related (for example, an array, boolean, truth, lies). System Such variable names will be correct.

To write a program code, the register does not matter. For example, the word procedure can be written both with large and small letters. Moreover, large and small letters can be alternating inside the word.

For the platform, it does not matter. However, according to the rules of good tone, the beginning of the word need to write with a capital letter, all the other letters are small.

Regarding the language. You can use the Russian language, and English, and a combination of two languages. If someone is convenient, you can safely use English to write a program code, as well as combine Russian and English. For the platform it is not important.

Many names on english language It is quite difficult to remember. When using a combination of two languages, the readability of the program code is worsen.

Boolean operations

In comparison operators, the Boolean logic is very often used, which returns the value of truth or false.

For example, in the conditional statement, you can compare: if an event \u003d sale then the algorithm will go on one branch (that is, with the value of truth), by the condition, another branch of the algorithm is performed.

Conditions can be quite complicated, they can be combined, the following operators are used: and, or, and not. So, for the operator and:

Truth and truth \u003d truth;
Truth and lies \u003d false;
Lie and truth \u003d lies;
Lies and lies \u003d lies.

For a defrost or enough, so that one of the operands is equal to the truth, then the combination value will be true. The value of the lie is obtained only when both operands lie.

The operator does not simply invert the current value (a lie to the truth, the truth in a lie).

Using a combination of data of operators, it is enough to build enough complex conditions. In the preparation of complex conditional operators, priorities should be taken into account.

The highest priority has an operator not, the following is the operator and, and after it, the operator or. What is enclosed in brackets has the highest priority and is performed first.

For example, lay priorities (execution sequence) for operations in the above expression:

Not (condition1 or condition2) and condition3 or condition4
1. Result1 \u003d (condition1 or condition2);
2. Result2 \u003d not result1;
3. Result3 \u003d result2 and condition1;
4. Result \u003d result3 or condition4;

There is a conversion rule:

No (condition1 or condition2) \u003d no condition1 and no condition2.

However, it should not always strive to simplify the expression, since it is often, the expression is easier to be read.

Application operator

Doing the assignment operator with equality should not be confused, despite the fact that they have the same writing.

The principle of operation of the assignment operator is that the left value (variable from the left side) is assigned the value that is to the right of the equality sign. We will analyze an example:

Variable1 \u003d variable2 \u003d variable3;

The variable1 is assigned the value of equality from Boolean logic, i.e. Truth, if the variable2 \u003d variable3, or false in the opposite case.

When testing to the position of a novice programmer, a task is often used: change the values \u200b\u200bof two variable places.

This task is solved using the assignment operator and has two solutions.

Solution No. 1 using a temporary variable:
Temporable value \u003d variable1;
Variable1 \u003d variable2;
Variable2 \u003d temporary variable;

Decision number 2:
Variable1 \u003d variable1 + variable2;
Variable2 \u003d variable1 - variable2;
Variable1 \u003d variable1 - variable2;

Conditional operator

There is such an operator if, after which it is necessary to describe a certain condition (the condition itself can be quite large). After the condition, the word then the executed operators.

Next can follow the keyword otherwise and a series of other operators. If there are several different conditions, you can use a series of keywords Inaccession (See Example below). The whole design must be completed by a key word. Following, after which the point is shown.

In addition to simple and multiple conditions there is an abbreviated form conditional operator:? (Condition, expression1, expression2);

If the condition is true, it will be performed Expression1, otherwise - Expression2.. Sample code: expensiveovar \u003d? (Product. Price\u003e 100000, truth, lies);

In practice, instead of comparison records with meaning True (False) Type:

If the variable \u003d truth then
and
If the variable \u003d lies then

equivalent records are actually used:

If the variable then
and
If not a variable then

Cyclic operators

For any type of cycle, it is necessarily a clear indication of the end of this cycle using keywords EndCycle. There are several types of cycles.

Cycle by counter - A cycle with a fixed number of repetitions. The condition exit from the cycle is to exude a boundary value. An example of use for calculating the value A!

A \u003d 5;
Factorial \u003d 1;
For counter \u003d 1 by and cycle
Factorial \u003d factorial * Counter;
EndCycle;

Cycle by condition - Until truly condition of this cycle. Example:

Residuesum \u003d 1000;
Prices of price \u003d 243;
Quantity \u003d 0;
While the rescues\u003e 0 cycle
Quantity \u003d number + 1;
Residuesum \u003d residuesum - the number of * pricker shares;
Prices of price \u003d customer value * 0.8;
EndCycle
Quantity \u003d quantity-1;

This cycle calculates how many units of goods can be bought on this amount (1000 rubles), if, after purchasing each unit of goods, its previous price is multiplied by the coefficient of 0.8. The initial price of the product is 243 rubles.

An example of an error when using this type of cycle of newbies is the eternal cycle, when the cycle condition initially is truly true, and within the cycle itself it does not change.

Cycle on collections (another name for everyone).

In the platform there is a fairly large number of collections (these are such containers that contain elements of a particular type).

Course elements of the collection can be using a special type cycle.

For example, there is an array of numbers, it is necessary to calculate the sum of all elements of the array:

Sum \u003d 0;
For each element from the array cycle
Sum \u003d sum + element;
EndCycle;

For cycles there are special operators: Proceed and Interrupt.

If at some point of the cycle, the execution of further operators of this turn becomes meaningless, then to return to the beginning of the cycle and organize its next round is used by the operator Proceed.

Operator Interrupt Allows you to complete the execution of the cycle, even if the Cycle Correction is true.

On this we are completing our first acquaintance with the development in the internal language 1C.

But what about Hello World? We have not written it yet, right? Yes, but nothing prevents you from doing it yourself, because Knowledge is already enough. Well, if it does not work, you can peel here.