788 views
4 votes
Even though the var keyword allows a variable to change its value, its type is fixed. For example, this code doesn't compile:

a) True
b) False

User MiFi
by
7.5k points

1 Answer

3 votes

Final answer:

The var keyword allows a variable to change its value, but its type remains fixed.

Step-by-step explanation:

The correct answer is a) True.

The var keyword in programming languages like JavaScript allows a variable to change its value. However, the type of the variable defined with the var keyword is not flexible and remains fixed once assigned a value. In the example given, if the code contains a variable declared using the var keyword and the assigned value is incompatible with the declared type, the code will not compile and will result in an error.

User A Alstone
by
7.5k points