goto关键字


在Java中,goto是保留字,但是并没有使用。

Although reserved as a keyword in Java, goto is not used and has no function

在C/C++中,goto的使用:

int main()
{
	int countDown = 10;
	loop:
	cout<<countDown<<endl;
	--countDown;
	if(countDown > 0)
		goto loop;
}

10
9
8
7
6
5
4
3
2
1


在bat批处理中也可以使用goto关键字:

if exist 1.txt goto txt
if exist 1.bat goto bat
goto end
:txt
rename 1.txt 1.bat
goto end
:bat
rename 1.bat 1.txt
:end

Over...

你可能感兴趣的:(java,java,java,C++,C++,c,c,bat,bat,bat,goto,goto)