Back to questions
JuniorTheoryCommon
What does the program print (lines separated by spaces)?
Процедура Очистить(Знач Список)
Список.Очистить();
Список = Новый Массив;
Список.Добавить("новый");
КонецПроцедуры
Товары = Новый Массив;
Товары.Добавить("ручка");
Копия = Товары;
Очистить(Копия);
Сообщить(Товары.Количество());
Сообщить(Копия.Количество());0 0
- Expecting
Значto protect the array's contents: it copies the reference, and the method still changes the same array - Expecting
Копия = Товарыto copy the array: the assignment gives the same array a second name
- How do you make a real copy of an array so changes do not reach the original?
- What would the program print without
Значon the parameter ofОчистить?