Author |
Message |
chalcids
|
Posted: 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. |
|
|
|
|
![](images/spacer.gif) |
Sponsor Sponsor
![Sponsor Sponsor](templates/subSilver/images/ranks/stars_rank5.gif)
|
|
![](images/spacer.gif) |
Zren
![](http://compsci.ca/v3/uploads/user_avatars/1110053965512db6185954b.png)
|
Posted: 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? |
|
|
|
|
![](images/spacer.gif) |
Tony
![](http://wiki.compsci.ca/images/f/f4/OniTony.gif)
|
|
|
|
![](images/spacer.gif) |
chalcids
|
Posted: 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 |
|
|
|
|
![](images/spacer.gif) |
Dragon20942
![](http://compsci.ca/v3/uploads/user_avatars/17452741294d1f674ad0f2f.jpg)
|
Posted: 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. |
|
|
|
|
![](images/spacer.gif) |
[Gandalf]
![](http://compsci.ca/v3/uploads/user_avatars/189297994e4c716fec7f1.png)
|
Posted: 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! |
|
|
|
|
![](images/spacer.gif) |
Amarylis
|
Posted: 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
|
|
|
|
|
|
![](images/spacer.gif) |
chalcids
|
Posted: Thu Dec 01, 2011 5:27 pm Post subject: Re: Goto command or coding |
|
|
yeah thats what i need thanks |
|
|
|
|
![](images/spacer.gif) |
Sponsor Sponsor
![Sponsor Sponsor](templates/subSilver/images/ranks/stars_rank5.gif)
|
|
![](images/spacer.gif) |
|