
-----------------------------------
[Flame][Boy]
Thu Dec 15, 2005 6:46 pm

Timer
-----------------------------------
Hey ive come up with this simple timer code but the only thing i cant figure out is why it isnt exiting at 0. Anyone know whats going on?


var counter : int := 5
loop
    locate (1, 1)
    put counter - round (Time.Elapsed / 1000)
    exit when Time.Elapsed = 0
end loop


-----------------------------------
Mr. T
Thu Dec 15, 2005 6:57 pm

Alex's Opinion
-----------------------------------
You have to understand that Time.Elapsed  is a predefined Turing command. Thus, you cannot edit by performing an operation on it. Rather, you must declare a variable and store all the operations you do to Time.Elapsed in it. 
var counter : int := 5 
var endStatement : int 
loop 
    locate (1, 1) 
    endStatement := counter - round (Time.Elapsed / 1000) 
    put counter - round (Time.Elapsed / 1000) 
    exit when endStatement = 0 
end loop ode:

-----------------------------------
Mr. T
Thu Dec 15, 2005 6:57 pm

Re: Alex's Opinion
-----------------------------------
You have to understand that Time.Elapsed  is a predefined Turing command. Thus, you cannot edit it by performing an operation on it. Rather, you must declare a variable and store all the operations you do to Time.Elapsed.
var counter : int := 5 
var endStatement : int 
loop 
    locate (1, 1) 
    endStatement := counter - round (Time.Elapsed / 1000) 
    put counter - round (Time.Elapsed / 1000) 
    exit when endStatement = 0 
end loop ode:

-----------------------------------
McKenzie
Thu Dec 15, 2005 6:57 pm


-----------------------------------
Time.Elapsed will never be 0 but counter - round (Time.Elapsed / 1000) will be at some point

-----------------------------------
Mr. T
Thu Dec 15, 2005 7:00 pm

Alex's Opinion
-----------------------------------
Sorry about the double post. Gah can someone delete the second one.  :oops:
