V Forum

[ log in ]

why doesn't work this

k1attila12 Mar 21 16:51
orry i'm new here, only played with this :

import time


fn main() {
ticks:=time.ticks()
mut j:=f64(101)


for i:=0 ; i < 100 ; i++ { //if i < 100 then loop doesn't work

j=j+(f64(i)*j)
}


println(j) //result ??
println(f64((time.ticks()-ticks)/10000)) //result ??

println(1/1000000)

}

Thank you
Attila
bokunodev Mar 29 07:12
what your expected output ?
bokunodev Mar 29 07:13
what output do you expect?
k1attila12 Mar 29 09:09
Dear bokunodev !

It doesn't print anything. The problem is in println(j) . But i don't know why. Try it.
if loop is <1000 (instead of 100) it works well. Interesting.
Thank you



Powered by Vorum, open-source blogging/forum software written in V