{}const=>[]async()letfn</>var
Basics1C

Programming in 1C: Introduction for Beginners

Learn the basics of 1C programming. Let's analyze variables, loops, queries and creation of interfaces in 1C:Enterprise.

К

Kodik

Author

3 min read

The 1C programming language is used to develop applications on the platform 1C: Enterprise. This is one of the most popular tools for automating business processes in Russia and other countries. In this article, we will look at the basics of programming in the 1C language, its features and basic constructions.


What is the 1C language?

1C language is a high-level programming language built into the system 1C: Enterprise. It is used to write business logic, process data, and create interfaces. 1C programs are created both for the automation of business processes (accounting, personnel management, trade, etc.) and for the implementation of complex corporate systems.

The main tasks solved with the help of programming in the 1C language:

  • Automation of calculations and accounting.

  • Creation of reports and analytics.

  • Development of user interfaces.

  • Data processing and integration with external systems.


🔥 100,000+ students already with us

Tired of reading theory?
Time to code!

Kodik — an app where you learn to code through practice. AI mentor, interactive lessons, real projects.

🤖 AI 24/7
🎓 Certificates
💰 Free
🚀 Start learning
Joined today

Basic elements of the 1C language

The 1C programming language has its own features that distinguish it from other languages. Below we will consider the main elements of the syntax.

Variables and data types

1C does not require an explicit indication of the data type of variables, since the type is determined automatically at the time of assigning a value. The main data types in 1C:

  • Number — integers and real numbers (for example, 100, 3.14).

  • Line — a sequence of characters (for example, "Hello").

  • Boolean — logical values (True or False).

  • Date — date and time.

Example of declaring variables:


Перем Сумма;
Сумма = 1000;

Перем Строка;
Строка = "Hello, world!";

Перем ЛогическоеЗначение;
ЛогическоеЗначение = Истина;

Condition operators and loops

As in most programming languages, 1C supports conditional operators (Если) and loops (Для, Пока).

Example of using the conditional operator Если:


Если Сумма > 500 Тогда
    Сообщить("Amount is more than 500");
Иначе
    Сообщить("Amount less than or equal to 500");
КонецЕсли;

Example of the Для cycle:


Для Номер = 1 По 10 Цикл
    Сообщить(Номер);
КонецЦикла;

Procedures and functions

Procedures and functions in the 1C language are used to perform repetitive actions and can take parameters. The difference between them is that a function returns a value, and a procedure does not.

Example of the procedure:


Процедура ПечатьСообщения(Сообщение)
    Сообщить(Сообщение);
КонецПроцедуры;

ПечатьСообщения("Hello, 1C!");

Example of a function:


Функция Сложить(Число1, Число2)
    Возврат Число1 + Число2;
КонецФункции;

Сообщить(Сложить(5, 10)); // Displays 15

Working with tables and queries

One of the key features of 1C is working with databases and tables. For this, 1C uses the object Request, which allows you to get data from the database.

Example of a simple query:


Запрос = Новый Запрос;
Запрос.Текст = "SELECT Name, Price FROM Reference.Book.Products";
Результат = Запрос.Выполнить();

Для Каждого Товар Из Результат Цикл
    Сообщить(Товар.Наименование + ": " + Товар.Цена);
КонецЦикла;

This query selects the names and prices of goods from the "Goods" directory and displays them using a loop.


Creating a form and interface elements

In 1C, you can create forms and interface elements for working with data and interacting with the user. Forms include elements such as buttons, input fields, tables, etc.

Example of creating a form with a button:


Форма = Новый Форма;
Форма.Заголовок = "Form example";

Кнопка = Форма.Элементы.Добавить("Button", ТипЭлементаФормы.Кнопка);
Кнопка.Текст = "Click me";

Форма.Открыть();

Conclusion

The 1C programming language provides powerful tools for automating business processes. In this article, we learned the basics of syntax, how to declare variables, write procedures and functions, work with queries, and create interface elements. This is just a basic introduction, and the world of 1C programming is much broader. Keep learning and practicing!

🎯Stop procrastinating

Liked the article?
Time to practice!

In Kodik, you don't just read — you write code immediately. Theory + practice = real skills.

Instant practice
🧠AI explains code
🏆Certificate

No registration • No card