Why if executes two times?

If I set a breakpoint at if statement, I see that the statement gets
executed two times… why so?

It shouldn’t happened, may be due to IDE gives the illusion to you.

ZhanGNer wrote in post #1071763:

It shouldn’t happened, may be due to IDE gives the illusion to you.

So how can I find the reason for illusion? or what I need to do now?

On 9 August 2012 19:32, ajay paswan [email protected] wrote:

ZhanGNer wrote in post #1071763:

It shouldn’t happened, may be due to IDE gives the illusion to you.

So how can I find the reason for illusion? or what I need to do now?

There are three questions I would need you to answer to be able to help
further:

  • What is the if statement in question?
  • Is it in a reentrant position (e.g. a loop)?
  • What are you using to set a breakpoint / debug the program?


Matthew K., B.Sc (CompSci) (Hons)
http://matthew.kerwin.net.au/
ABN: 59-013-727-651

“You’ll never find a programming language that frees
you from the burden of clarifying your ideas.” - xkcd

ZhanGNer wrote in post #1071768:

awesome
Really!

see the program:

var=5
if var == 10 #breakpoint here
puts(“Variable is 10”)
end

I am using a breakpoint here ‘pointed’ and when I press resume, it comes
again here, but when I program with java, this is not the case, it goes
to the next step. I use intelliJ IDEA.

  • What is the if statement in question?
  • Is it in a reentrant position (e.g. a loop)?
  • What are you using to set a breakpoint / debug the program?

Just where the breakpoint is marked, is the place I set the breakpoint,
and in the next statement also I set the break point, but it doesnt go
to next till it gets executed two times, and yes I am using a
debugger…with intelliJ idea and ruby.

awesome
may be you can paste your code if possible, and point out which line you
set a breakpoint.