Posts

Showing posts from June, 2017

Control Flow For Swift

Swift provides a variety of control flow statements. These include  while  loops to perform a task multiple times;  if ,  guard , and  switch  statements to execute different branches of code based on certain conditions; and statements such as  break  and  continue  to transfer the flow of execution to another point in your code. Swift also provides a  for - in  loop that makes it easy to iterate over arrays, dictionaries, ranges, strings, and other sequences. Swift’s  switch  statement is considerably more powerful than its counterpart in many C-like languages. Cases can match many different patterns, including interval matches, tuples, and casts to a specific type. Matched values in a  switch  case can be bound to temporary constants or variables for use within the case’s body, and complex matching conditions can be expressed with a  where  clause for each case. For-In Loops :   ...