Swift Program to Create Different Types of Variables

You are currently viewing Swift Program to Create Different Types of Variables

Swift program to create different types of variables

// Swift program to create different types 
// of variables

var intVar:Int      = 10;
var floatVar:Float  = 10.34;
var strVar:String   = "Hello World";
var boolVar:Bool    = true;

print("IntVar  : ",intVar   );
print("FloatVar: ",floatVar );
print("StrVar  : ",strVar   );
print("BoolVar : ",boolVar  );

Output

IntVar   :  10
FloatVar:  10.34
StrVar  :  Hello World
BoolVar :  true

...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