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

Username:   Password: 
 RegisterRegister   
 Is there any way to output the current Line?
Index -> Programming, Turing -> Turing Help
View previous topic Printable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic
Author Message
jamie543




PostPosted: Wed Mar 30, 2011 9:51 am   Post subject: Is there any way to output the current Line?

Just looking for a command that outputs the current line of code.
Sponsor
Sponsor
Sponsor
sponsor
apython1992




PostPosted: Wed Mar 30, 2011 10:31 am   Post subject: RE:Is there any way to output the current Line?

There's nothing that's I'm aware of that lets you do that (unless you manually stop the program, which I think will tell you where the program broke), but the best way to know where your program is at is to output stuff to the screen. For example, if you want to see if your program gets to a certain point, you could use a put statement right before that line of code, that just contains the line (or anything you want to make it unique) in a string! Using put statements at various points will tell you quickly where your program gets to, and where it never reaches. This is in fact how many people do their debugging (I for one refuse to trace with an IDE Very Happy).
Raknarg




PostPosted: Wed Mar 30, 2011 11:25 am   Post subject: RE:Is there any way to output the current Line?

Actually, there is a way.
There's a command called break; put it anywhere and it will stop wherever break is.
The thing thats useful about it is after you put it in and run the program to break, you get new command buttons on the code screen. You can then just run the code line by line to see everything that's happening.
DemonWasp




PostPosted: Wed Mar 30, 2011 12:04 pm   Post subject: RE:Is there any way to output the current Line?

You can enable that extra set of buttons with a menu item regardless of whether you have breaks in your code.

This also does not fulfill the OP's request because it doesn't output the current line. It's a helpful debugging tool, sure, but it's not what was requested.

OP: No, there isn't any way to do that.
Tony




PostPosted: Wed Mar 30, 2011 1:44 pm   Post subject: RE:Is there any way to output the current Line?

I think the appropriate question here is -- what is that "current line of code" needed for?
Latest from compsci.ca/blog: Tony's programming blog. DWITE - a programming contest.
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  [ 5 Posts ]
Jump to:   


Style:  
Search: