Recent

Author Topic: wrong condition check in while and for loops  (Read 728 times)

svd71

  • New Member
  • *
  • Posts: 33
wrong condition check in while and for loops
« on: January 08, 2025, 02:01:57 pm »
Hallo all,

I am not sure, is it one mistake of Lazarus or fpc.

You can see it at the attached picture. Variables i and j have values 0 and condition "(i < j)" is a false. But any way, jump the debugger in the loop.
With 'for'-loop have same mistake. But only is first value of the variable 'i' as 40.

About the Lasarus:
Version 3.2
FPC 3.2.2
FREE_UNKNOWN_REVISION
X86-64-win64-win32/win64

The project have default values for OS, CPU and etc.

BR.

Zvoni

  • Hero Member
  • *****
  • Posts: 2798
Re: wrong condition check in while and for loops
« Reply #1 on: January 08, 2025, 02:08:57 pm »
Quote
I am not sure, is it one mistake of Lazarus or fpc.
In 99.99999% cases it's the user.....

Code: Pascal  [Select][+][-]
  1. while i < j do;
... Spot the mistake....
One System to rule them all, One Code to find them,
One IDE to bring them all, and to the Framework bind them,
in the Land of Redmond, where the Windows lie
---------------------------------------------------------------------
Code is like a joke: If you have to explain it, it's bad

TRon

  • Hero Member
  • *****
  • Posts: 3810
Re: wrong condition check in while and for loops
« Reply #2 on: January 08, 2025, 02:13:45 pm »
I was so distracted by all the highlighted lines, colors, selected text, underlined graphics, arrows and text that I completely overlooked that.

Nice catch Zvoni.
I do not have to remember anything anymore thanks to total-recall.

 

TinyPortal © 2005-2018