Ответы к упражнению (область видимости)
<source lang="kpp" line="1"> function f(const int p) {
var x = 1, k = 2; print("x = #{x}, k = #{k}\n"); //(1) x = 1, k = 2 { x = 5; var k = 3; print("x = #{x}, k = #{k}\n"); //(2) x = 5, k = 3 } print("x = #{x}, k = #{k}\n"); //(3) x = 5, k = 2
if (p > 5) { print("x = #{x}\n"); //(4) x = 5 } else { var x = 10; var y = "hello"; print("x = #{x}, #{y}\n"); //(5) x = 10, y = hello x = 6; } print("x = #{x}\n"); //(6) x = 5 print("#{y}"); //(7) ошибка времени компиляции (переменная не объявлена)
} </source>
Содержание |
Would Gandhi Use Social Media?
If Gandhi were alive today, would he use social media? He was never anti-technology, or even anti-changing with the times. Quite the opposite, actually. If Internet technologies and social networks were around, he would certainly have embraced them -- but with a conscious mindfulness of their strengths and weaknesses.
[Would Gandhi Use Social Media?]
Student Goes From Homeless to Harvard
Despite being abandoned to homelessness by her parents, Dawn Loggins worked as a high school custodian by day and studied hard by night to become the first person from her school to ever be admitted to Harvard.
[Student Goes From Homeless to Harvard]
The Relationship Between Gifts & Community
Wherever I go and ask people what is missing from their lives, the most common answer (if they are not impoverished or seriously ill) is "community." What happened to community, and why dont we have it any more? There are many reasons the layout of suburbia, the disappearance of public space, the automobile and the television, the high mobility of people and jobs and, if you trace the "whys" a few levels down, they all implicate the money system.
[The Relationship Between Gifts & Community]
10 Keys to Happier Living
Action for Happiness has developed the 10 Keys to Happier Living based on a review of the latest scientific research relating to happiness. Everyones path to happiness is different, but the research suggests these Ten Keys consistently tend to have a positive impact on peoples overall happiness and well-being.
[10 Keys to Happier Living]
Nintendo Unveils Wii U Console
Nintendo Co. on Tuesday unveiled details of its Wii U videogame console to be launched late this year, featuring a tablet computer-like controller with touch-sensitive panel.
[Nintendo Unveils Wii U Console]