local f_1 = 1;
local f_2 = 1;
local sum = f_1 + f_2;
for i = 1, 10 do
print(sum)
f_1 = f_2;
f_2 = sum;
sum = f_1 + f_2;
end
local f_1 = 1;
local f_2 = 1;
local sum = f_1 + f_2;
for i = 1, 10 do
print(sum)
f_1 = f_2;
f_2 = sum;
sum = f_1 + f_2;
end
Don't doubt yourself. Many people who have been developing for many years can't write a quick sort correctly in half an hour. The most important thing to do programming is to get ideas to solve the problem, and then solve the problem. For example, I can't read your lua grammar, but I can write a lua script to solve the problem. If you love it, don't doubt it. If you choose to go ahead, don't doubt it. The only thing left behind is the figure
at least you will ask
whether you don't understand the Fibonacci sequence
, or do you not understand this algorithm, or are other things difficult to understand?
assuming you know Fibonacci sequence
, but do not understand this algorithm, then I think programming may really not be suitable for you.
nothing, it was hard for me to understand even exchanging two variables at first.
the key is to see if you are interested in it, who is born to understand it.
mainly depends on whether you want to do it or not. If you want to do it, make up your mind to make a good effort. If you want not to learn, it is impossible.
No matter whether it is suitable or not, you will know
Previous: When PHP multiple processes commit, the data is inserted repeatedly.
Next: What technology is needed to develop a PC-side decoration software?