Sunday, 26 February 2017

Control Statement




// for in : loop to iterate over a sequence, such as ranges of numbers
for index in 1...5 {
    print("\(index) times 5 is \(index * 5)")
if index == 4
{
break;
}
}


// while statement

//  fallthrough statement
var j  = 8;
switch(j)
{
 case 8:
    print(" value - 8")
fallthrough
case 16:
print( "16 value");
fallthrough
default:
print( "default value");

}

No comments:

Post a Comment