Back to questions
JuniorTheoryCommon
What happens when the program runs?
Перем Итого;
Процедура Добавить(Сумма)
Итого = Итого + Сумма;
Скидка = 10;
КонецПроцедуры
Итого = 0;
Добавить(100);
Добавить(50);
Сообщить(Итого);
Сообщить(Скидка = Неопределено);Nothing prints: a compile error, variable Скидка is not defined
- Expecting a variable assigned in a procedure to be visible in the module body: it is local, and the module needs
Перемto share it - Expecting the lines before the error to run: this is a compile error, so the module never starts
- How would you make
Скидкаvisible in the module body? - Why does
Итогоchange insideДобавитьwhileСкидкаstays local?