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

Username:   Password: 
 RegisterRegister   
 Goto command or coding
Index -> Programming, Turing -> Turing Help
View previous topic Printable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic
Author Message
chalcids




PostPosted: Wed Nov 23, 2011 9:02 am   Post subject: Goto command or coding

I need coding or a command that I could use to go to a line or go to a variable!
Please it I need some code or logic.
Sponsor
Sponsor
Sponsor
sponsor
Zren




PostPosted: Wed Nov 23, 2011 11:35 am   Post subject: RE:Goto command or coding

What are you trying to do? Why do you need to go to a specific line? Would a loop not solve this? What about calling specific lines in a procedure?
Tony




PostPosted: Wed Nov 23, 2011 1:45 pm   Post subject: RE:Goto command or coding

Nope. You didn't "want" a goto since at least 1968[1] and you didn't "need" it after 1973[1]

So if you don't want a goto... and don't need to use it... what exactly are you asking?

[1] http://dl.acm.org/citation.cfm?id=362947
[2] http://dl.acm.org/citation.cfm?id=362337
Latest from compsci.ca/blog: Tony's programming blog. DWITE - a programming contest.
chalcids




PostPosted: Wed Nov 30, 2011 11:03 am   Post subject: Re: Goto command or coding

I need it because in my program i need it to go from line 22 to line 609 because i don't want to rewrite the same code again besides the goto command is not bad for some it might fro others it is a life saver
Dragon20942




PostPosted: Wed Nov 30, 2011 1:07 pm   Post subject: RE:Goto command or coding

Simply use a loop and a condition if you want to avoid rewriting code.

Turing:

var thing : int := 0

loop
    if thing = 5 then
        do
        something
    end if
   
    thing += 1
    put thing
end loop


That way, you dont need to write "thing += 1" 5 times before presenting the condition.
[Gandalf]




PostPosted: Wed Nov 30, 2011 9:47 pm   Post subject: RE:Goto command or coding

Or better yet, it sounds like you want to split your code up into procedures, which are like gotos but better!
Amarylis




PostPosted: Wed Nov 30, 2011 10:07 pm   Post subject: Re: Goto command or coding

You sound like you'd need a procedure more so than you would a loop

Turing:

procedure ProcedureName
    Code
end ProcedureName



/*
 * Calling a procedure. I'm guessing you would be using an if statement?
 */




if condition then
    ProcedureName
elsif condition then
    Something else
end if

chalcids




PostPosted: Thu Dec 01, 2011 5:27 pm   Post subject: Re: Goto command or coding

yeah thats what i need thanks
Sponsor
Sponsor
Sponsor
sponsor
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  [ 8 Posts ]
Jump to:   


Style:  
Search: