Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/loops/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Loops jython输入验证,而循环映射_Loops_Input_While Loop_Jython_Exit - Fatal编程技术网

Loops jython输入验证,而循环映射

Loops jython输入验证,而循环映射,loops,input,while-loop,jython,exit,Loops,Input,While Loop,Jython,Exit,我尝试使用while-true循环,因此如果在用户尝试输入时使用负整数,它将退出菜单,我的问题在于我的第二次迭代要求用户输入 我的第一次迭代: choice=1 while choice1>=0: choice1=requestInteger("Please enter the first city you would like to visit") while(choice1>9): choice1=requestInteger("Error, Pl

我尝试使用while-true循环,因此如果在用户尝试输入时使用负整数,它将退出菜单,我的问题在于我的第二次迭代要求用户输入

我的第一次迭代:

choice=1
while choice1>=0:  
    choice1=requestInteger("Please enter the first city you would like to visit")
    while(choice1>9):
      choice1=requestInteger("Error, Please enter a city that corresponds with the number on the map")
我的第二次迭代直接在下面:

while choice2>=0:
  choice2=requestInteger("Please enter the first city you would like to visit")
  while(choice1>9):
    choice1=requestInteger("Error, Please enter a city that corresponds with the number on the map")
第三:

      choice3=1
  while (choice3>0):

    choice3=requestInteger("Please enter another city you would like to visit")
    while(choice3>9):
      choice3=requestInteger("Error, Please enter a city that corresponds with the number on the map")
第二次迭代从不循环,而是继续循环到第一次循环。我怎样才能解决这个问题