View Full Version : IF and GOTO Commands...
luckyspin956
12-08-2006, 6:49 PM
Explain the importance of the IF and GOTO commands. When are they used?
Write a short batch program that uses both IF and GOTO commands.
Mntsnow
12-08-2006, 7:10 PM
Me thinks its time for you to post what you think they are...and then we can help you where you might be off :)
You wont learn by someone else doing your homework
luckyspin956
12-08-2006, 7:15 PM
i know i know, but all i want to do is pass this class, im changing my major, since this is not what i want, but since im taking it i need to pass it... =|
ThRoNkA
12-08-2006, 9:42 PM
ill explain goto and if commands
if is a conditional statement. It tests a certain theory in a program or batch file
example, you have 4 roses. Your friend has 2 roses.
you can say it like this in english. Now if you want
to say that if you have more than your friend, then give him an apple.
Now that you know how to write it in english lets type it togther. You will need to know less than or equalto commands <= and >=
yourself = 5
friend = 3
if yourself <= friend
{
yourself = yourself-1
friend = friend+1
}
You should understand reading it mathimatically :)
thats above one tests that. Now once you get to both mean equal that program section exits to the next one.
You can add a condition statment like this to the end provided you initalize the command or section area.
if yourself <= friend
goto "print 'even!' " (substritute the " and 's accordingly)
vBulletin® v3.7.3, Copyright ©2000-2008, Jelsoft Enterprises Ltd.