Swift Program to Create a Constant

You are currently viewing Swift Program to Create a Constant

Swift program to create a constant

// Swift program to create a constant

let num:Int = 10;

// error: cannot assign to value: 'num' is a 'let' constant
// num = 20;

print("Num: ",num);

Output

Num:  10


...Program finished with exit code 0
Press ENTER to exit console.

Ranjith

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

Leave a Reply