it didnt' work

0 views
Skip to first unread message

tzenobite

unread,
Dec 27, 2009, 5:39:30 AM12/27/09
to iPhoneWebDev
and i can't figure out why :(

i got this really simple loop:


function elapseddistance()
{
if ((cminutes) > (startminutes-1)) {

//do something i know it's working
}
var t;
t=setTimeout("elapseddistance()",100);
}

the loop take the actual time (cminutes) as minutes, calculated
elsewhere, and the theoric start time as minutes (calculated elsewhere
too), both as global variables
i got spy fields, so i can see that cminutes IS more than
startminutes, but if i try the loop without the if trap it works, with
the trap it didn't work despite of any value of cminutes and
startminutes
i fear this will be a really stupid error, but i'm coding for two
days, maybe i'm not as awaken as i need to be ;-)

many many thanks!
matteo

toriaezunama

unread,
Dec 31, 2009, 6:04:31 AM12/31/09
to iPhoneWebDev
I am not sure i understand your problem fully Matteo but i tried the
following code with a break point on > var bob = 1;
and it stopped there every time. i.e. your code seems to work fine

var cminutes = 5;
var startminutes = 2;


function elapseddistance() {
if ((cminutes) > (startminutes-1)) {
//do something i know it's working

var bob =1;


}
var t;
t=setTimeout("elapseddistance()",100);
}

// Main
function load() {
elapseddistance();

Reply all
Reply to author
Forward
0 new messages