Swift programming

Swift programming for Beginners – Swift Closures

(Swift for Beginners) Swift Closures In this article, you’ll learn what is a closure, syntax, types of closures in Swift with examples. In the article Swift functions, we created a function using func keyword. However, there is another special type of function in Swift, known as closures that can be defined without using keyword func and a function name. Like functions, …

Swift programming for Beginners – Swift Function Overloading

(Swift for Beginners) Swift Function Overloading In this article, you will learn about function overloading, when do we need function overloading and how to overload with examples. Two or more functions having same name but different argument(s) are known as overloaded functions. Why do we need function overloading? Imagine you are developing a shooter game …

Swift programming for Beginners – Swift Nested Functions

(Swift for Beginners) Swift Nested Functions In this article, you will learn about nested functions in Swift and how it works with examples. If a function exists inside the body of another function, it’s called nested function. Syntax of a nested function func funcname() { //statements of outer function func anotherFuncname() { //statements of inner …

Swift programming for Beginners – Swift Function Parameters and Return Values

(Swift for Beginners) Swift Function Parameters and Return Values In this article, you’ll learn about different user defined functions that takes inputs of different types and returns output, with examples. In the previous article Swift Functions, we learned about functions. Now, we’ll look at the different ways and types we can create a function in …