Answer the question
In order to leave comments, you need to log in
Why put curly braces after a method call?
For example, there is a class MyClass, it has a method int myMethod.
When called from another method of another class, the following construction is used:
MyClass::myMethod();
{
...
различные операции
...
}
int var = 0;
{
...
}
Answer the question
In order to leave comments, you need to log in
Curly braces create a new block with its own scope (this has nothing to do with the last expression):
int A = 0;
{
int A = 1;
int B = 1;
std::cout << A << "\n"; // 1
std::cout << B << "\n"; // 1
}
std::cout << A << "\n"; // 0
//std::cout << B << "\n"; // <-- error: B was not declared in this scope
I am a complete zero in the pros, so I can only assume that this is somehow related to the scope of the variables. For example, some variables are not available from outside such a block. Or, for example, inside the block, you can do whatever you want with the variable var
, but outside it will still be equal to zero.
Well, at least that would make sense.
position:absolute; top:0; bottom:0;
if the screen height is not the page height but the screen height i.e. viewport, then height:100vh;
PS and in order for the height to be considered 100%, you also need to set the parent of the parent, and so on until we reach the top of the DOM or stumble upon an element with a height not in percent, from which we can start counting
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question