Swift Program to Demonstrate the Enumeration

Swift program to demonstrate the enumeration

// Swift program to demonstrate enum

import Swift

enum Colors {
    case RED
    case GREEN
    case BLUE
    case WHITE
}

enum Fruits {
    case MANGO, APPLE, BANANA, PAYAYA
}

print("Colors: ",Colors.RED,Colors.GREEN,Colors.BLUE,Colors.WHITE)

print("Fruits: ",Fruits.MANGO,Fruits.APPLE,Fruits.BANANA,Fruits.PAYAYA)

Output

Colors:  RED GREEN BLUE WHITE
Fruits:  MANGO APPLE BANANA PAYAYA

...Program finished with exit code 0
Press ENTER to exit console.
Share on:

Hi, I'm Ranjith a full-time Blogger, YouTuber, Affiliate Marketer, & founder of Coding Diksha. Here, I post about programming to help developers.

Leave a Comment