POV-Ray : Newsgroups : povray.general : Some Basic Loop Questions : Re: Some Basic Loop Questions Server Time
3 Aug 2024 00:20:26 EDT (-0400)
  Re: Some Basic Loop Questions  
From: Alain
Date: 22 Jun 2004 20:20:12
Message: <40d8ccbc$1@news.povray.org>
Glen Berry nous apporta ses lumieres ainsi en ce 22/06/2004 21:45... :

>I'd like to know if the following things are possible within POV-Ray's
>scene language, either directly or via some indirect workaround.
>
>1)  When doing a while loop, is it possible to conditionally abort the
>loop and continue processing the rest of the scene file, if a certain
>condition tests true? I believe this ability exists in some
>programming languages, but I don't know how to do it with POV.
>  
>
Yes like this:
#local I=0;
#while(I<10)
    <<some code>>
    #if(stopingcondition)#local SaveIndex=I; // only if you need to 
preserve the index at whitch the stop condition became true.
        #local I=10;#end // Set the loop index past the end value!
    #local I = I + 1;
#end

Alain


Post a reply to this message

Copyright 2003-2023 Persistence of Vision Raytracer Pty. Ltd.