Swap the numbers in swift program interchange the values in swift programming language.
To interchange the values in swift we have used the = method to change the values are initially allocated in the swapping the number program in swift
Var Statement in Swift
In Swift, both let and var are used to create variables.
Let aids in the creation of immutable variables, whereas var aids in the creation of mutable variables.
Both of them create variables that either hold a reference or a value.
Print Statement in Swift
The print statement instructs the computer to print something to the terminal or printer. It can be used in a variety of ways.
Printing the value of a single variable is one option.
A print “statement” is actually a call to the System. out object’s print or println method.
The print method only takes one argument, whereas the println method only takes one argument or none.
Swap Numbers in Swift
Swapping is a mechanism for temporarily moving a process from main memory to secondary storage (disc) and making that memory available to other processes.
The system switches the process from secondary storage to main memory at a later time. In memory, to replace pages or chunks of data.
Swapping is a mechanism that allows a computer to run programs and modify data files that are larger than the primary memory.
The operating system copies as much data into main memory as feasible and saves the rest to disc. Paging is another term for swapping.
var a = 0 var b = 1 (a, b) = (b, a) print(a, b)