Addition of Two Numbers in Swift

Addition of two numbers in swift. This program will execute the swift program outside of the condition and it will print the output through the return statement in swift programming language

Let Keyword in Swift

The let keyword in Swift can be used to create immutable variables. A constant that can only be initialised once is called an immutable variable. If you try to reassign, reinitialize, or change a let variable, you’ll get a compiler error. Var variables, on the other hand, can be altered. Let and var are two basic strategies for storing values that a programmer can access using a name. If you’ll never change the value associated with that name, use let.

Addition of Two Numbers in Swift

When two positive integers are added together, the result is always a positive sum; when two negative integers are added together, the result is always a negative sum. Take the absolute value of each integer and subtract these values to determine the total of a positive and a negative integer.

Return Statement in Swift

The return statement in Swift simply returns the values or expressions from the enclosing function. You can use the return statement to return one or more values in a single statement. The sum of two numbers supplied in the enclosing sum function is returned by the return statement.

let sum = 
(a: Int, b: Int) -> Int in 
return a + b 
let number = sum(20,30)