Booklet

author

Hack University

IT & Software

5 Basic Programming Operators You Should Know

5 BASIC PROGRAMMING OPERATORS YOU SHOULD KNOW

𝗔𝘀𝘀𝗶𝗴𝗻𝗺𝗲𝗻𝘁 𝗢𝗽𝗲𝗿𝗮𝘁𝗼𝗿𝘀

Assigns a value to a variable.

Example:

𝗰𝗼𝗹𝗼𝗿 = '𝗯𝗹𝗮𝗰𝗸';

The value of 𝗰𝗼𝗹𝗼𝗿 is now 𝗯𝗹𝗮𝗰𝗸.

𝗔𝗿𝗶𝘁𝗵𝗺𝗲𝘁𝗶𝗰 𝗢𝗽𝗲𝗿𝗮𝘁𝗼𝗿𝘀

Performs basic math.

Example:

𝗮𝗿𝗲𝗮 = 𝟯 * 𝟮;

The value of 𝗮𝗿𝗲𝗮 is now 𝟲.0

𝗦𝘁𝗿𝗶𝗻𝗴 𝗢𝗽𝗲𝗿𝗮𝘁𝗼𝗿𝘀

Combines two strings.

Example:

𝗻𝗮𝗺𝗲 = '𝗛𝗮𝗰𝗸' + '𝗨𝗻𝗶𝘃𝗲𝗿𝘀𝗶𝘁𝘆';

The value of 𝗻𝗮𝗺𝗲 is now 𝗛𝗮𝗰𝗸 𝗨𝗻𝗶𝘃𝗲𝗿𝘀𝗶𝘁𝘆.

𝗖𝗼𝗺𝗽𝗮𝗿𝗶𝘀𝗼𝗻 𝗢𝗽𝗲𝗿𝗮𝘁𝗼𝗿𝘀

Compares two values and returns 𝘁𝗿𝘂𝗲 or 𝗳𝗮𝗹𝘀𝗲..

Example:

𝗹𝗮𝗿𝗴𝗲 = 𝟰 > 𝟴;

The value of 𝗹𝗮𝗿𝗴𝗲 is 𝗳𝗮𝗹𝘀𝗲.

𝗟𝗼𝗴𝗶𝗰𝗮𝗹 𝗢𝗽𝗲𝗿𝗮𝘁𝗼𝗿𝘀

Combines expressions and returns 𝘁𝗿𝘂𝗲 or 𝗳𝗮𝗹𝘀𝗲.

Example:

𝗹𝗮𝗿𝗴𝗲 = (𝟴 > 𝟰) && (𝟯 < 𝟲);

The value of 𝗹𝗮𝗿𝗴𝗲 is now 𝘁𝗿𝘂𝗲.

𝗦𝘂𝗺𝗺𝗮𝗿𝘆

• 𝗔𝘀𝘀𝗶𝗴𝗻𝗺𝗲𝗻𝘁 𝗢𝗽𝗲𝗿𝗮𝘁𝗼𝗿𝘀 - Assigns a value to a variable.

• 𝗔𝗿𝗶𝘁𝗵𝗺𝗲𝘁𝗶𝗰 𝗢𝗽𝗲𝗿𝗮𝘁𝗼𝗿𝘀 - Performs basic math.

• 𝗦𝘁𝗿𝗶𝗻𝗴 𝗢𝗽𝗲𝗿𝗮𝘁𝗼𝗿𝘀 - Combine two strings.

• 𝗖𝗼𝗺𝗽𝗮𝗿𝗶𝘀𝗼𝗻 𝗢𝗽𝗲𝗿𝗮𝘁𝗼𝗿𝘀 - Compares two values and returns 𝘁𝗿𝘂𝗲 or 𝗳𝗮𝗹𝘀𝗲..

• 𝗟𝗼𝗴𝗶𝗰𝗮𝗹 𝗢𝗽𝗲𝗿𝗮𝘁𝗼𝗿𝘀 - Combine expressions and returns 𝘁𝗿𝘂𝗲 or 𝗳𝗮𝗹𝘀𝗲.

More booklets by Hack University

More IT & Software booklets

Your recently viewed booklets

  • booklet-slide-images
  • booklet-slide-images
  • booklet-slide-images
  • booklet-slide-images
  • booklet-slide-images
  • booklet-slide-images
  • booklet-slide-images
  • booklet-slide-images
  • booklet-slide-images
  • booklet-slide-images
See all booklets