To multiply two numbers in Swift, you can use the *
operator. Here's an example:
main.swift57 chars5 lines
In this example, we first declared two variables x
and y
and assigned them the values 5
and 7
. We then multiplied these two numbers using the *
operator and stored the result in a new variable z
. Finally, we printed the value of z
using the print()
function, which outputs 35
.
gistlibby LogSnag