Commands are simple. They look like this: print(“Hello World!”) As you can see, these commands don’t have a semicolon, unlike JavaScript and a few other languages. Output: Hello World!
Variables
It looks like this: var name = 3 Output: name = 3 Again, it doesn’t have a semicolon. Variables can be changed, like this: Add: name += 1 Output: name = 4 Subtract: name -= 1 Output: name = 2
Constants
These are written like this: let name = 3 Output: name = 3 You can not change these, so name will always be equal to 3.
Loops
Loops are written like this:
for i in 1...3{
//This loop repeats 3 times.
}
This loop does nothing, but to make it do something, add code inside the curly brackets.
Hi! Today we will learn Swift.
Commands
Commands are simple. They look like this:
print(“Hello World!”)
As you can see, these commands don’t have a semicolon, unlike JavaScript and a few other languages.
Output:
Hello World!
Variables
It looks like this:
var name = 3
Output:
name = 3
Again, it doesn’t have a semicolon.
Variables can be changed, like this:
Add:
name += 1
Output:
name = 4
Subtract:
name -= 1
Output:
name = 2
Constants
These are written like this:
let name = 3
Output:
name = 3
You can not change these, so
name
will always be equal to3
.Loops
Loops are written like this:
This loop does nothing, but to make it do something, add code inside the curly brackets.
That’s it for today!
@CodeABC123 nice 👍