
-----------------------------------
SAValkyrie
Thu Nov 01, 2012 7:48 pm

Need Help with Turing
-----------------------------------
What is it you are trying to achieve?
Trying to write a program that endlessly tells you to "Have a good day"
Tr y stopping execution. Change it so that it is a program to wish you a good day only six times.


What is the problem you are having?
I got the "Have a good day" part but I cannot figure you the only six times part. With my knowledge, the only thing i can do is to state the word that can stop the execution. Is there a way to stop it when it counts 6 times?



Please specify what version of Turing you are using
Turing 4.1.2

-----------------------------------
chipanpriest
Thu Nov 01, 2012 7:58 pm

Re: Need Help with Turing
-----------------------------------
Either look into increments. or if you're really adventurous, look into for statements.

I'll give you this much, to exit a loop, you can type "exit when". Eg.


loop
exit when %whatever
end loop

You can set the whatever to anything you want, which can help in your situation.

Think about it, if you want the loop to exit after 6 times, how would you get the loop to count?

-----------------------------------
SAValkyrie
Thu Nov 01, 2012 8:22 pm

Re: Need Help with Turing
-----------------------------------


for count:1..6



Is the use of count appropriate in this situation?[/syntax]

-----------------------------------
Tony
Thu Nov 01, 2012 8:33 pm

RE:Need Help with Turing
-----------------------------------
Yes, you can use for-loops to execute a piece of code a specific number of times.

-----------------------------------
SAValkyrie
Thu Nov 01, 2012 8:36 pm

Re: Need Help with Turing
-----------------------------------

var count:int
count:=0
loop
    count:=count+1
    put "Have a good day"
    exit when count=6
    Time.Delay(500)
end loop


ah i got it[/syntax][/quote]

-----------------------------------
chipanpriest
Fri Nov 02, 2012 5:25 am

Re: Need Help with Turing
-----------------------------------
LOL your second comment was different than your first. Both work though. You could use a for statement:


for count : 1 .. 6
put "Have a good day!"
Time.Delay (500)
end for

I like this better but both ways work.
