Skip to main content

Posts

Showing posts with the label Control Flow Statements

Control Flow Statements - statements used in swift

List out what is the control transfer statements used in swift
Control flow statements are used to control the flow of execution in a program. There are several types of control flow statements in Swift, including loop statements, branch statements, and control transfer statements.  1.Loop statements allow a block of code to be executed repeatedly 2. Branch statements allow a certain block of code to be executed only when certain conditions are met 3.Control transfer statements provide a way to alter the order in which code is executed. 4.Swift provides a do statement to introduce scope, and catch and handle errors, 5.Defer statement for running cleanup actions just before the current scope exits.



Loop Statements -
Loop statements allow a block of code to be executed repeatedly, depending on the conditions specified in the loop. Swift there are three loop statements ·For-in statement ·While statement ·Repeat-while statement A for-in statement allows a block of code to be executed once for ea…