Topic-4: Variable

  • Variable is a container where we will store out data .
  • Variable is a memory location inside RAM .

Rules for define a variable name : 

1 .  Allowed Character 

  •  All alphabets are allowed (A-Z and a-z)
  • Numbers are allowed(0-9)
  • Only one special symbol is allowed (_)
  • Except (_) others are not allowed
 Example:- 
  • abc=90 – – > valid
  • abc@20=90 – – > invalid

2 . Variable name should be started with alphabet ,if we started with digit then compiler will gives us error .

 Example:-
  • abc=90 – – > valid
  • 9abc=90 – – > invalid
3 . Space is not allowed in variable name
4 . Keyword name we can not use as our variable name .
Example:-
  • if=90 – – > invalid
  • while=90 – – > invalid
  • else=90 – – > invalid

Leave a Comment

Your email address will not be published. Required fields are marked *