Hi, I’m doing the Introduction to Julia course (https://juliaacademy.com/courses/375479/lectures/5816184) and this happens when i run the code for a while loop.
¿Could someone explain this to me and tell me the correct way to do it?
Hi, I’m doing the Introduction to Julia course (https://juliaacademy.com/courses/375479/lectures/5816184) and this happens when i run the code for a while loop.
¿Could someone explain this to me and tell me the correct way to do it?
the warning message before the error literally tells you what’s going on, please read it.
In this case, you want to take the global i
advise probably
Welcome @nicoo-c
You find all you need about this here: Scope of Variables · The Julia Language
Thanks, I understand now.
Solved with:
i = 0
while i < 10
global i += 1
println(i)
end