Sign in Join
Wiki copytemporary

With/ru: what changed

Revision 0 to 1. Removed lines have a minus sign; added lines have a plus sign.

Title: With/ru

OldNewLine
1+[[Reserved word/ru|Зарезервированное слово]] **with** предназначено для сокращенного написания типа [[Record/ru|запись (структура)]]. Оно используется совместно с ключевым словом [[Do/ru|do]].
2+
3+Пример:
4+
5+``` pascal
6+// Объявление записи (структуры)
7+type
8+ TreRecord = record
9+ strValue: string;
10+ intValue: integer;
11+ dblValue: double;
12+ end;
13+
14+var
15+ reRecord: TreRecord; // Объявляем переменную типа "запись"
16+
17+begin
18+ ...
19+
20+ // стандартное обращение к полям записи:
21+ reRecord.strValue := 'Test';
22+ reRecord.intValue := 5;
23+ reRecord.dblValue := 4.2;
24+
25+ // с использованием слова "with"
26+ with reRecord do
27+ begin
28+ strValue := 'Test';
29+ intValue := 5;
30+ dblValue := 4.2;
31+ end;
32+ ...
33+end;
34+```
35+
36+---
37+*From the Free Pascal wiki, page "With/ru", as it stood on 2020-03-04 after a change by Trev, out of the wiki's dump of 2024-05-26. Copyright stays with the author who wrote it, according to the old wiki's [[Licensing]] page. If you have concerns about this material, [message the admin](/wiki-contact).*

Back to history