
-----------------------------------
comp_help
Sat Apr 11, 2009 9:09 pm

turing - help w outputting numbers on 1 line
-----------------------------------
Ok, I would like to output this code on 1 line, and it has to be using loops. Should I make ten variables to store all the numbers then output them all in the end? or Is there any other way?  :? 


var count: int:= 10

loop
put count
exit when count = 0
count:= count - 1
end loop


-----------------------------------
Dusk Eagle
Sat Apr 11, 2009 9:15 pm

Re: turing - help w outputting numbers on 1 line
-----------------------------------
Just put a .. after your "put foo" statement. That's all you have to do!

-----------------------------------
saltpro15
Sat Apr 11, 2009 9:18 pm

RE:turing - help w outputting numbers on 1 line
-----------------------------------
you need this

var count: int:= 10

loop
put count ..
exit when count = 0
count:= count - 1
end loop


note I added a .. after put count, to keep Turing on the current line

-----------------------------------
comp_help
Sat Apr 11, 2009 9:19 pm

RE:turing - help w outputting numbers on 1 line
-----------------------------------
Wow! that was nice but I need to put space, actually tab, in between the numbers, How do I do this? Thanks

-----------------------------------
comp_help
Sat Apr 11, 2009 9:22 pm

Re: turing - help w outputting numbers on 1 line
-----------------------------------
Nvm, I got it  :) 

var count: int:= 10

loop
put count, "\t"..
exit when count = 0
count:= count - 1
end loop

So, Thank you very much Saltpro15 and Dusk Eagle.

One last thing, what is ".." function called? Is it in turing reference?

-----------------------------------
Zren
Sun Apr 12, 2009 12:12 am

Re: turing - help w outputting numbers on 1 line
-----------------------------------
Oh wow. The Turing reference actually refers to it as dot-dot. That's it.


put:
This put statement is sometimes used to close off a line that has been output piece by piece using put with dot-dot.

&&

locate:
put "*" ..  % Use dot-dot to avoid clearing end of line
