Draft:1С: Programming Language

From Wikipedia, the free encyclopedia

1С programming language
Paradigmobject-oriented, Procedural programming, Event-driven
Developer1C Company
First appeared1996; 28 years ago (1996)
Typing disciplinedynamic
Filename extensions.epf

1С programming language - it is a Russian programming language developed by 1C Company. It is used to expand the functionality of 1С: Enterprise. It is supplied together with the 1С: Enterprise family of programs. As part of 1С: Enterprise is used in 95 countries.[1] The main users of this language is large organizations that use the platform to organize business processes and automate tasks.

This embedded language is a domain-specific programming language, specially designed taking into account the possibility of its application not only by professional programmers. In particular, all language operators have both Russian and English spelling, which can be used simultaneously in the same source text.[2]

The embedded language has many common features with other languages such as Pascal, Java Script, BASIC, which makes it easier for novice developers to master. However, it is not a direct analogue of any of the listed languages.[3]

Programs written in an embedded language are not independent and they are part of the configuration of the 1С: Enterprise program and are called programming modules[4] or treatments - a program that can be formatted as a file with the .epf extension[5]

Examples[edit]

This program defines a function that tries to divide a number by zero and intercepts the error by printing an error message:

Процедура ПриНачалеРаботыСистемы()
    Попытка
        а=1/0;
    Исключение
        Сообщить("Деление на 0");
    КонецПопытки;
КонецПроцедуры

This program defines a procedure "УдалитьСтрокиТекста" that deletes from a text file "Text.txt " all lines containing the substring "1C":

Процедура УдалитьСтрокиТекста() # Define procedure
	ТекстДок = Новый ТекстовыйДокумент; # Init variable
	ТекстДок.Прочитать("Text.txt"); # Read file
	Сч = 1; # Init line counter
	Пока Сч < ТекстДок.КоличествоСтрок() Цикл # While loop
		Строка = ТекстДок.ПолучитьСтроку(Сч); # Get Сч line
        КолвоСтрк = Найти(Строка, "1С"); # Number of occurrences of a substring in a string
		Если КолвоСтрк > 0 Тогда # Start of a conditional expression
			ТекстДок.УдалитьСтроку(Сч); # Delete line
		Иначе # Else
			Сч = Сч + 1;
		КонецЕсли; # End of condition
	КонецЦикла; # End of loop
	ТекстДок.Записать("Text.txt"); # Write result into file "Text.txt"
КонецПроцедуры # End of procedure

References[edit]