The following code fragment will not compile. Why?

```
if !x > x + y
x = 2 * x;
else
x = x + 3;
```


We need to add a couple pairs of parentheses. The boolean expression for an if statement must be in parentheses. And we must apply the not operator to a boolean value.
if (!(x > x + y))

Computer Science & Information Technology

You might also like to view...

Explain why using the “weakest iterator” that yields acceptable performance helps produce maximally reusable components

What will be an ideal response?

Computer Science & Information Technology

Infrared, a wireless connection used in the past prior to Bluetooth, was limited because it ________

A) required a direct line of sight between devices B) was not able to connect devices to the Internet C) was not managed correctly by its developer and therefore never became commercially successful D) only enabled two devices to connect

Computer Science & Information Technology

The default display of gridlines in Excel is to display the major gridlines and hide the minor gridlines

Indicate whether the statement is true or false

Computer Science & Information Technology

On a client/server network, the client sometimes is called a host computer.

Answer the following statement true (T) or false (F)

Computer Science & Information Technology