### 3.1 - Loops

n = 0
m = 1


#=
# Major problems. n is not recognized inside the while loop. This makes the loop unusable 
while n < 10
    n += 1
    println(m)
end
=#


for i ∈ 0:10
    println(i)
    println(n)
end

# Q1

for n in 1:100
    print(n^2, ", ")
end

# Q2

sq_dict = Dict{Int64, Int64}()

for n in 1:100
    print(n^2, ", ")
    sq_dict[n] = n^2
end

# Q3

squares_arr = [i^2 for i in 1:100]

@assert length(squares_arr) == 100
@assert sum(squares_arr) == 338350



### 3.2 - Conditionals

# Q1

x = 4

if (x % 2) == 0
    println(x)
else
    println("odd")
end


# Q2

(x % 2) == 1 ? println(x) : println("odd")




### 3.3 - Functions

# Q1

add_one = x -> x+1


# Q2 & Q3

M = [i+j for i in 1:3, j in 1:3]
add_one.(M)