Back to questions
JuniorTheoryCommon
What does the program print?
Сумма = 3000;
ЕстьКарта = Ложь;
Скидка = 0;
Если Сумма > 1000 Тогда
Если ЕстьКарта Тогда
Скидка = 10;
Иначе
Скидка = 5;
КонецЕсли;
КонецЕсли;
Сообщить(Скидка);5
- Expecting
0, as ifИначеbelonged to the outerЕсли: it stands inside and belongs to the nearestЕсли ЕстьКарта - Expecting
Если ЕстьКартаto check that the variable is filled: the condition takes its value, hereЛожь
- How would you write the same logic with
Иinstead of nesting? - What happens if the inner
КонецЕсли;is missing?