Free Salesforce Developers Tutorials >

Chapter 3 - Apex Datatypes and Operators >

Shorthand Operator

Shorthand Operator

What You’ll Learn


tickWhat are the Shorthand Operator in Apex?

tickWhat is OR assignment and AND assignment operator?

tickHow to use shorthand operator in Apex?

S2 Labs

What Is Shorthand Operator?

These are operators used to assign values with operations by using short syntax.

How to use the shorthand operator?

For using a shorthand operator, we need to put the operator just before the assignment operator to perform the operation.

For Example, x += y or x *= y or x -= y or x /= y or x |= y

What Is OR Assignment and AND Assignment Operator?

  1. |= (OR assignment operator): If X(boolean) and Y(boolean) are both false then X remains false otherwise X is assigned true.
  2. &= (AND assignment operator): If X(boolean) and Y(boolean) are both true then X remains true otherwise X is assigned false.
Salesforce Developer

Download Study Material

Get access to exclusive study material for Salesforce Certification and ace your exams!

Download Now

Our Salesforce Certification Courses

Hey there! Glad you made it through our Salesforce Developer Training for beginners . But wait! We've got some high-in-demand Salesforce courses for you to take your Salesforce skills to the next level, making you a desired professional in the Salesforce job market.

Post a Comment

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