Swap the numbers program in a swift basic programs

Swap the numbers program in swift programming language. This 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 a = 0

var b = 1

(a, b) = (b, a)

print(a, b)

 

Output:

1 0

What is swapping in programming language

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.