[Scilab-users] Nested while loops

classic Classic list List threaded Threaded
3 messages Options
Chris Gardner Chris Gardner
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

[Scilab-users] Nested while loops

To solve a problem I am working on, I would like to nest several while loops (up to maybe 10 serially) within another while loop.  The structure I need is something like:

for i = 1:N

        while (condition 1)
                action 1

                while  (condition 2)
                        action 2
                end

                while (condition 3)
                        action 3
                end

                while (condition 4
                        action 4
                end

                action 5

        end

end

I have tried to implement this but have had trouble getting it to work.  Should it work?

Thanks, Chris
_______________________________________________
users mailing list
[hidden email]
http://lists.scilab.org/mailman/listinfo/users
Claus Futtrup Claus Futtrup
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Nested while loops

Hi Chris

To the best of my knowledge such nested while loops should be no
problem. It should work.

To show the problem, for us to test and see, could you create an
executable script, which fails?

Best regards,
Claus

On 08-08-2017 19:19, Chris Gardner wrote:

> To solve a problem I am working on, I would like to nest several while loops (up to maybe 10 serially) within another while loop.  The structure I need is something like:
>
> for i = 1:N
>
> while (condition 1)
> action 1
>
> while  (condition 2)
> action 2
> end
>
> while (condition 3)
> action 3
> end
>
> while (condition 4
> action 4
> end
>
> action 5
>
> end
>
> end
>
> I have tried to implement this but have had trouble getting it to work.  Should it work?
>
> Thanks, Chris
> _______________________________________________
> users mailing list
> [hidden email]
> http://lists.scilab.org/mailman/listinfo/users
>

_______________________________________________
users mailing list
[hidden email]
http://lists.scilab.org/mailman/listinfo/users
Chris Gardner Chris Gardner
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Nested while loops

Hi Claus

Thanks for your quick response.  I must be doing something silly.  Each of the inner while loops involves solving a set of ODEs so is fairly complicated.  I will see if I can simplify things a bit so you can see what I am trying to do.

Chris


> On Aug 8, 2017, at 1:48 PM, Claus Futtrup <[hidden email]> wrote:
>
> Hi Chris
>
> To the best of my knowledge such nested while loops should be no problem. It should work.
>
> To show the problem, for us to test and see, could you create an executable script, which fails?
>
> Best regards,
> Claus
>
> On 08-08-2017 19:19, Chris Gardner wrote:
>> To solve a problem I am working on, I would like to nest several while loops (up to maybe 10 serially) within another while loop.  The structure I need is something like:
>>
>> for i = 1:N
>>
>> while (condition 1)
>> action 1
>>
>> while  (condition 2)
>> action 2
>> end
>>
>> while (condition 3)
>> action 3
>> end
>>
>> while (condition 4
>> action 4
>> end
>>
>> action 5
>>
>> end
>>
>> end
>>
>> I have tried to implement this but have had trouble getting it to work.  Should it work?
>>
>> Thanks, Chris
>> _______________________________________________
>> users mailing list
>> [hidden email]
>> http://lists.scilab.org/mailman/listinfo/users
>>
>
> _______________________________________________
> users mailing list
> [hidden email]
> http://lists.scilab.org/mailman/listinfo/users

_______________________________________________
users mailing list
[hidden email]
http://lists.scilab.org/mailman/listinfo/users
Loading...