Get The Basic Of Swift Programming Language

swift Introduction

Swift is a new programming language used for iOS and OS X Application development. It was developed by Apple in 2010.

What is Swift programming language?

Swift programming language is the best language to develop iOS Applications and Mac OS X Applications.It is a new programming language, introduced by Apple with the new features listed below,
  1. A programmer writes our code and it immediately executes.
  2. Swift has syntax like objective-C.
  3. Swift uses existing Cocoa frameworks.
  4. Swift is safe and has a safe programming pattern.
Swift programming comes from the various popular programming languages like Python, Ruby and C# etc.

Syntax of Swift programming language
  1. import Cocoa  
  2. var srt1 = "Hello, World!"  
  3. println(str1)  
Syntax of Swift programming language is very similar to Python programming.

Decision making statement

Swift programming language has many decision making statements like C programming language, which are:
  1. if statement
  2. if else statement
  3. leader if else statement
  4. nested if statement
  5. switch statement
I have only one statement dedicate declare to the variable the sample program in if else statement. program,
  1. var a = 10  
  2. var b = 20  
  3. if (a < b) {  
  4.     print("a is less than b")  
  5. else {  
  6.     print("b is greater than a")  
  7. }  
if else statement is condition true,
  1. print("a is less than b")  
another else statement is condition false,
  1. print("b is greater than a") exit the program.  

Build smarter apps with Machine Learning, Bots, Cognitive Services - Start free.

Start Learning Now