Programming C, C++, Java, PHP, Ruby, Turing, VB
Computer Science Canada 
Programming C, C++, Java, PHP, Ruby, Turing, VB  

Username:   Password: 
 RegisterRegister   
 turing - help w outputting numbers on 1 line
Index -> Programming, Turing -> Turing Help
View previous topic Printable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic
Author Message
comp_help




PostPosted: Sat Apr 11, 2009 9:09 pm   Post subject: 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? Confused

Turing:

var count: int:= 10

loop
put count
exit when count = 0
count:= count - 1
end loop
Sponsor
Sponsor
Sponsor
sponsor
Dusk Eagle




PostPosted: Sat Apr 11, 2009 9:15 pm   Post subject: 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




PostPosted: Sat Apr 11, 2009 9:18 pm   Post subject: RE:turing - help w outputting numbers on 1 line

you need this
Turing:

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




PostPosted: Sat Apr 11, 2009 9:19 pm   Post subject: 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




PostPosted: Sat Apr 11, 2009 9:22 pm   Post subject: Re: turing - help w outputting numbers on 1 line

Nvm, I got it Smile

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




PostPosted: Sun Apr 12, 2009 12:12 am   Post subject: Re: turing - help w outputting numbers on 1 line

Oh wow. The Turing reference actually refers to it as dot-dot. That's it.


Quote:
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
Display posts from previous:   
   Index -> Programming, Turing -> Turing Help
View previous topic Tell A FriendPrintable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic

Page 1 of 1  [ 6 Posts ]
Jump to:   


Style:  
Search: