function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
Ashritha ReddyAshritha Reddy 


What is enum can one give the example thanx in advance?
Amit Chaudhary 8Amit Chaudhary 8
An enum is an abstract data type with values that each take on exactly one of a finite set of identifiers that you specify. Enums are typically used to define a set of possible values that don’t otherwise have a numerical order, such as the suit of a card, or a particular season of the year. Although each value corresponds to a distinct integer value, the enum hides this implementation so that you don’t inadvertently misuse the values, such as using them to perform arithmetic. After you create an enum, variables, method arguments, and return types can be declared of that type.

To define an enum, use the enum keyword in your declaration and use curly braces to demarcate the list of possible values. For example, the following code creates an enum called Season:
public enum Season {WINTER, SPRING, SUMMER, FALL}
By creating the enum Season, you have also created a new data type called Season. You can use this new data type as you might any other data type. For example:
Season e = Season.WINTER;

Season m(Integer x, Season e) {

    if (e == Season.SUMMER) return e;

public enum Season {WINTER, SPRING, SUMMER, FALL}
Season s = Season.SUMMER;
if (s == Season.SUMMER) {
    // Will write the string value SUMMER
} else {
    System.debug('Not summer.');
Please check below post for more help

Let us know if this will help you

Amit Chaudhary