Chapter - 1: Getting Started

Which of the following are invalid variable names and why?


A
Sections
1
Exercises

A

B

C

1

B'day

Invalid: No special symbols are allowed.

 

while

Invalid: keywords cannot be used as a variable name

 

$hello

Invalid: No special symbols are allowed.

 

#HASH

Invalid: No special symbols are allowed.

 

dot.

Invalid: No special symbols are allowed.

 

number

Valid

 

totalArea

Valid

 

_main()

Invalid: No special symbols are allowed.

 

temp_in_Deg

Valid: _ is an exception

 

total%

Invalid: No special symbols are allowed.

 

1st

Invalid: Variable name cannot start with a number.

 

stack-queue

Invalid: No special symbols are allowed.

 

variable name

Invalid: No white space is allowed.

 

%name%

Invalid: No special symbols are allowed.

 

salary

Valid


© 2020 Garbage Valuegarbage value logo