In this post, we will see Switch When Statement in Apex Programming | Switch Case Statement | Apex Control Structures Part 3
Program Code (in Anonymous window) :
string var='b';
switch on var
{
when 'a'
{
system.debug('Apple');
}
when 'b'
{
system.debug('Banana');
}
when 'c'
{
system.debug('Cat');
}
when else
{
system.debug('Invalid');
}
}
No comments:
Post a Comment