Learn to Code via Tutorials on Repl.it

← Back to all posts
Learn Swift 1
CodeABC123 (10)

Hi! Today we will learn Swift.


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.
Hello World!


It looks like this:
var name = 3
name = 3
Again, it doesn’t have a semicolon.
Variables can be changed, like this:
name += 1
name = 4
name -= 1
name = 2


These are written like this:
let name = 3
name = 3
You can not change these, so name will always be equal to 3.


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.

That’s it for today!

CodeABC123 (10)

Announcement: Learn Swift 2 has a high chance that it will not get posted, but if it does, I will tell you.

CodeABC123 (10)

Why aren’t the code blocks working?

theangryepicbanana (1235)

@CodeABC123 you used a different character. you should be using backticks, not single quotes

theangryepicbanana (1235)

@CodeABC123 I think you have to verify your email in order to edit your posts

CodeABC123 (10)

Ugh, I’ll just make a new post and delete this post. @theangryepicbanana

CodeABC123 (10)

Just a small, or more like a HUGE problem: I can’t post anything anymore. @theangryepicbanana

CodeABC123 (10)

I can only post comments. And I’m about to delete this post. @CodeABC123

CodeABC123 (10)

Do you think people will still understand the post? @theangryepicbanana

CodeABC123 (10)

I have finally verified my email! @theangryepicbanana