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

Basics of 1C: Enterprise language syntax with examples and analysis 🔧

Learn how to start programming in 1C:Enterprise. We analyze the basic elements of the syntax: variables, operators, loops, procedures and functions. Examples and explanations will help you learn the language quickly and effectively. 🚀

К

Kodik

Author

4 min read

1C: Enterprise language syntax

The 1C:Enterprise programming language is designed to automate business processes and is widely used in Russia and the CIS countries. Its key feature is simplicity and intuitiveness, which makes the language accessible to both experienced developers and beginners. In this article, we will take a detailed look at the basics of the 1C language syntax, the features of its elements, and provide examples to consolidate the material. 🙂

Basic syntax elements

  1. Variables:

    In the 1C language, variables are declared without specifying the type, which simplifies their use. The variable type is determined automatically depending on the assigned value. This allows you to use variables flexibly without prior configuration.

    Перем x;
    x = 10;  // The variable "x" becomes a number
    x = "Hello";  // Now "x" line

    To improve readability and simplify debugging, it is recommended to use meaningful variable names that reflect their purpose. 📝

  2. Operators:

    • Assignment:

      The assignment operator is denoted by the sign =. It is used to assign values to variables, update their state, or perform mathematical calculations. ➕

      Перем y;
      y = 20;  // Assigning a number to a variable
      y = y + 5;  // Increase the value by 5
    • Conditional statements:

      Conditional operators allow the program to perform various actions depending on the fulfillment of a given condition. The Если...Тогда...Иначе structure is one of the most common. ☑️

      Если x > 10 Тогда
          Сообщить("Number is greater than 10");
      Иначе
          Сообщить("Number less than or equal to 10");
      КонецЕсли;

      If you need to check multiple conditions, you can use nested constructs Если or the ИначеЕсли keyword. 🎨

    • Cycles:

      Cyclic constructions simplify the execution of the same type of operations several times. There are two main types of loops in the 1C language: Для and Пока. ⏳

      // Example of a "For" loop
      Для i = 1 По 5 Цикл
          Сообщить("Iteration: " + Стр(i));
      КонецЦикла;
      
      // Example of a "Bye" cycleПерем j;
      j = 1;
      Пока j <= 5 Цикл
          Сообщить("Iteration: " + Стр(j));
          j = j + 1;
      КонецЦикла;

      Loops allow you to automate the processing of arrays, tables of values, and other data structures. 🔄

  3. Procedures and functions:

    Procedures and functions are the basic building blocks for creating modular and reusable code. They help structure the logic of the program and avoid duplication of code. 🎫

    Процедура ПечатьСообщения(Текст)
        Сообщить(Текст);
    КонецПроцедуры;
    
    Функция Сумма(Число1, Число2)
        Возврат Число1 + Число2;
    КонецФункции;
    
    // Using procedures and functions
    ПечатьСообщения("Hello, world!");
    Результат = Сумма(5, 10);
    Сообщить("Sum result: " + Стр(Результат));

    It is important to remember that functions always return a value, and procedures are used to perform actions. 🔧

  4. Comments:

    Comments are a tool for adding explanations to the code, which is especially important when developing a team or working with a large amount of code. The 1C language supports two types of comments: 🖋️

    • Single-line: using //;

    • Multiline: using /* */.

    // This is a single-line comment
    /* Это
       многострочный
       комментарий */

    Comments help make the code more understandable for developers who will work with it in the future. 🧠

  5. Data processing:

    1C widely uses data structures such as arrays, tables of values, strings, and numeric values. For example, you can use the following code to create and process an array:

    Перем МассивДанных;
    МассивДанных = Новый Массив;
    МассивДанных.Добавить("Element 1");
    МассивДанных.Добавить("Element 2");
    
    Для Каждого Элемент Из МассивДанных Цикл
        Сообщить(Элемент);
    КонецЦикла;

    Working with arrays and other data structures is a key element in the development of complex systems. 🔍

What are we going to do?

In this article, we got acquainted with the basic concepts of the 1C language syntax. We looked at how to declare variables, use operators, create loops, procedures, and functions, and add comments. The examples above helped you see how to apply the theory in practice and prepared you for the next step in learning the language. 💡

Further, you can deepen your knowledge by studying data processing methods, working with 1C platform objects and developing complex algorithms. ✨

Conclusions

The 1C:Enterprise language has a simple syntax and powerful tools, which makes it an excellent choice for automating business processes. The basics we've covered will help you confidently start programming and solving practical problems. 🚀

If you want to deepen your knowledge and start programming today, try the "Kodik" application. It offers step-by-step instructions, accessible examples, and interactive tasks that will help you master the 1C language and programming in general. Start your journey into programming right now! 🙌

🎯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