To add two numbers in Swift, you can use the addition operator (+). Here is an example code snippet:
main.swift74 chars5 linesIn the code above, we have declared two integer variables num1 and num2, assigned them values of 10 and 5 respectively, and then added them using the + operator. The result is stored in a third variable sum. Finally, we print the value of sum which is 15.
gistlibby LogSnag