Sharan Basappa wrote:
> 
> I am implementing an algorithm that I have worked out in theory. The 
> algorithm is in the form of a flowchart. The area where I am having problem
> is where the flow passes from a lower decision block to higher one. I can
> implement this using a do while block for such flow. The issue is when
> multiple such decisions block go back to same point in the flowchart. When I
> look at the flowchart, it looks like it can be simply translated into code
> using jump blocks if a language supports it.

It sounds like the

  next if $x < $y;

construct could be useful to you, which allows you to go to the next iteration
of the loop from any point within it.

> The other question I have is if my approach of using a flowchart was 
> incorrect in the first place. But I did flowchart to get my idea straight and
> uncovered lot of potential issues during this exercise.

Flowcharting was popular and relevant for early languages like BASIC and
FORTRAN, when there was no higher level 'for' or 'while' loop structure and you
had to rely on things like

    X = 0
200 X = X + 1
      :
    IF X < 10 THEN 200

It is still relevant for hand-coded assembler-language programs, but flowcharts
represent programs coded using 'goto', which is very much frowned upon in modern
programming.

HTH,

Rob

-- 
To unsubscribe, e-mail: beginners-unsubscr...@perl.org
For additional commands, e-mail: beginners-h...@perl.org
http://learn.perl.org/


Reply via email to