Session 6 Swift IOS Code

 IOS Mobile Application Development        

Session 6 Swift IOS Code

// switch Cases and fallthrough concept in switch
// So, what is switch Cases
// nested switch + if statement

var a = 3
var b = 3
var c = 5
switch(a)
{
  case 1:
  print("True case 1")

  case 2:
  print("True case 2")

  case 3,4:
  print("True case 3 Or 4")
switch(b)
{
  case 1:
  print("Nested case 1 ")
  case 2:
  print("Nested case 2 ")
  case 3:
  print("Nested case 3 ")
  if( c == 56)
  {
    print("True")
  }
  else
  {
    print("False")
  }
  default:
  print("Nested case default ")

}

  default:
  print("True case for default")

}

No comments:

Post a Comment

Fell free to write your query in comment. Your Comments will be fully encouraged.