In this project you will test Pascal, Ada, GO, Fortran, and VBScript (VBScript is NOT Visual Basic. They are two different languages), to see if the language implementation has short circuit evaluation in the AND Boolean construct. Short circuit evaluation is when the language evaluates the first portion of a BOOLEAN expression and if, knowing the result of the value, then skips the evaluation of second expression. For example, A & B is false if A is false, therefore no need to evaluate B. A similar scenario is true for OR. Most languages implement short circuit evaluation. Some languages can “turn on” and “off” the short circuit evaluation depending on the Boolean connector. An example of this implementation is the following (this is not actual code): function f() { write('I have been evaluated'); return(1); } main() { int i=1; if ( i ==0 && f() ) then write ('true') else write ('false’) }
In this project you will test Pascal, Ada, GO, Fortran, and
VBScript (VBScript is NOT Visual Basic. They are two different
languages), to see if the language implementation has short circuit
evaluation in the AND Boolean construct.
Short circuit evaluation is when the language evaluates the first
portion of a BOOLEAN expression and if, knowing the result of the
value, then skips the evaluation of second expression. For example,
A & B is false if A is false, therefore no need to evaluate B. A
similar scenario is true for OR.
Most languages implement short circuit evaluation. Some languages
can “turn on” and “off” the short circuit evaluation depending on
the Boolean connector.
An example of this implementation is the following (this is not
actual code):
function f()
{
write('I have been evaluated');
return(1);
}
main()
{
int i=1;
if ( i ==0 && f() ) then write ('true') else write ('false’)
}
Trending now
This is a popular solution!
Step by step
Solved in 2 steps