Back to questions
JuniorTheoryCommon
What does the program print?
Процедура Удвоить(Ч)
Ч = Ч * 2;
КонецПроцедуры
Процедура УдвоитьКопию(Знач Ч)
Ч = Ч * 2;
КонецПроцедуры
А = 5;
Удвоить(А);
УдвоитьКопию(А);
Сообщить(А);10
- Expecting
Аto stay 5, as in languages where a parameter is always a copy: withoutЗначthe parameter is passed by reference - Expecting
Значto change nothing: withЗначthe method gets a copy, and the change never reachesА
- What changes if
Удвоить(5)is called with a number instead of a variable? - When is it worth marking a parameter with
Знач?