+ 3
If operations
When joining more than one if operation, does one have to put brackets around the different "if" operations?
5 ответов
+ 8
no need to put brackets , it U only want to execute a single statement if if () condition evaluates to true
//Hatsy done right thing by using && same set of statement(s) are executing in the code having 2 if () statements
//can be written as ::
if (x > 30)
if (x < 60)
// do something
//can simply be
if (x > 30 && x < 60)
// do something
+ 7
Really depends on what you want to do, or what you mean by "joining more than one if operation".
int x = 56;
if (x > 30)
{
if (x < 60)
{
// do something
}
}
can simply be
if (x > 30 && x < 60)
{
// do something
}
+ 2
In the programming language Python.
+ 2
Thank you all for your answers.
+ 1
In which language ?