[Scilab-users] linking (jumping) from line of code to an other

Frieder Nikolaisen Frieder.Nikolaisen at student.hs-rm.de
Fri May 12 18:40:20 CEST 2017


 

The Solution is: Using whil: 

i = 1
a = 1
 while i < 5
 disp(i)
 a
= a + 1
 i = i +1
 if a == 3 then 
 i = i - 1
 end 

end

Am 2017-05-12
11:15, schrieb Frieder Nikolaisen: 

> Hello, 
> 
> another question to
solve the locomotive stuff, giving you a example with the not implented
code. 
> 
> I don't want to code the same stuff twice. Thats why I want
to jump between lines of code. Is this possible and how? 
> 
> P =
200;
> DM = 1;
> 
> for n = 1:10
> if DM == 1 then 
> if P > 100 then DM
= 1
> P = P - 60
> disp('P bigger 100. DM = ' + string(DM))
> else DM =
0
> P = P + 100 //instead of writing P = P + 100, I would like ...
>
disp('P smaller 100. DM = ' + string(DM))
> end 
> else // D == 0 
> if
P > 100 then DM = 1 
> disp('P bigger 100. DM = ' + string(DM))
> P = P
- 30
> else DM = 0 // ... to continue here 
> disp('P smaller 100. DM =
' + string(DM))
> P = P + 100 // to use this P = P + 100
> end
> end 
>
disp(string(n) + ' ' + string(P))
> end

 
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.scilab.org/pipermail/users/attachments/20170512/34899c9a/attachment.htm>


More information about the users mailing list