Expression returns false even though it should return true
Hi, I'm trying to check if a date is before now or after NOW. While debugging i can see that the expression doesn't return true even though it should.
16 Replies
can you show the value of
.Planned
here?it's above the bigger screenshot
@Pobiega
right, really hard to see 😄
well, thats... very weird.
I've never in my 20 years of programming encountered an actual "true is false" bug so I doubt we are seeing one here either
hahah sorry, yea i'm kind of scratching my head.
yea there must be something i'm doing wrong
There was another post yesterdya where the debugger showed "" != "" so could be a similar thing here?
Assuming it's 10:52 or earlier where op lives then it doesn't make sense
it's 12.52 pm here
Planned is for 11:40
yea
I guess i'll explain
i have a list with objects and if time has passed past the .Planned property i want to remove it from the list
So even if DateTime.Now advances, it wouldn't change the outcome
So i have objects i need to remove that are tomorrow and before the time that is now
Does it run the if anyway with a breakpoint?
If so, then the debugger is messed up
there's no exception
and i'm not expecting there to be one
No exception, just if it enters the if block
i'll check one sec
oh my god
i just saw it
i'm so stupid
It removes the objects that are before now
but not after today
But it's because I'm first checking if it's less than now and then checking if it's more than today
so since it's not less than now it's never gonna reach the second if block
it's at moments like this i'm wondering if i really should be doing this lol
We all make dumb mistakes
quick question, do list indexes start at 0 or 1?