Android App Development
iOS App Development
Flutter App Development
Cross Platform App Development
Hire on-demand project developers and turn your idea into working reality.
Big thanks to Webkul and his team for helping get Opencart 3.0.3.7 release ready!
Deniel Kerr
Founder. Opencart
Top Partners
In this blog, we will know about control flow in swift
There are multiple types of control flow in swift:-
While loop will perform on a single condition. It will perform until the condition will false.
the flow of the while loop:-
1. It will check the condition2. if it is true3. then it will execute the statement 4. if it is false 5. then it will not execute the statement
for example
In this loop we can perform the statement until the condition
Syntex:
example:-
the flow of the for in loop:-
1. it will check the condition
2. if it is true3. then it will execute the statement
4. it will increase the value of val5. if it is false 6. then it will not execute the statement
it will compare the two objects and on the result of the comparison it will perform the statement
Syntex:-
It works the same as if-else it will check the condition and perform accordingly
if obj1 has nil value then it will perform return and if it has value then it will assign value in obj2
It will perform like if-else but it is different from the if-else
in switch it will check the each condition and if it is matched to any one it will stop the matching with other
it has a default statement if there is not any matched statement then it will perform default statement
call the function checkswitch with the integer parameter
I hope this blog will help you to understand Swift control flow if you have any comments, questions, or recommendations, feel free to post them in the comment section below!
For other technical blogs, please click here.
If you want to know more about swift please check here
Your email address will not be published. Required fields are marked*
Name*
Email*
Save my name email and website in this browser for the next time I comment.
Be the first to comment.
We use cookies to personalize your experience. By continuing to visit this website you agree to our use of cookies. Learn more about privacy policy
Name
Email
Subject
Enquiry or Requirement
If you have more details or questions, you can reply to the received confirmation email.