with the following:
if(
(condition)
&& (condition)
&& (condition)
&& (condition)
)
{
}
else
{
};
does the compiler know to fail the test when one of the conditions is false? That would be part of the language specification.
Does this exist in any language?
Quote:Original post by speciesUnknown
does the compiler know to fail the test when one of the conditions is false? That would be part of the language specification.
In C and C++, yes, it's indeed part of the language specification for &&.
Quote:Original post by speciesUnknown
with the following:
if(
(condition)
&& (condition)
&& (condition)
&& (condition)
)
{
}
else
{
};
does the compiler know to fail the test when one of the conditions is false?
Yes, it does. It's called short-circuit evaluation. && is a short-circuit operator.
Quote:That would be part of the language specification.
You want to make a whole language just for this, which can already be easily done with existing languages?
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement