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
lapaullapaul 

Select Case construct

Hi,

Is there a similar Select Case construct in Apex? I use this Select Case construct from .Net platform as an example.

Please advice. Thanks

 

Select

  statement1..

End Select

Case

Jeremy_nJeremy_n

Nope, there is no Select Case or Switch statement right now in Apex. Your best bet is to use a bunch of IFs.

 

Jeremy

MycodexMycodex

ultimate fail- nested if statements are so 90s.

 

For those visiting this post, promote the idea

 

Add "Switch" or "Case" Statement to Apex: https://sites.secure.force.com/ideaexchange//apex/ideaview?id=08730000000BrSIAA0