In Java, is there a way to set a line in a method to return to at any point later in the method? -


i'm learning program in java , i'm wondering if there simple way set return point in method in case user decides want go back. example, within method, ask user choose between 1 of 3 options:

1) register

2) search

3) other

let's user chooses register. choice presents them 2 new options:

1) register user

2) register admin

let's choose register admin. prompted enter information, maybe halfway through realize "wait! want register user, not admin!". typing in "back" option, , if so, want able take them menu choose between user , admin, not way beginning. there way this? know use loops, program bit more complicated example, rather not if can around it. i'm looking way similar way can name loops in assembly language, can "go point" , goes without user having re-enter information did before sub menu want to. (i realize in example don't enter info until sub menu. in actual program do.)

any ideas? if worse comes worse, i'm not opposed using loop. figured ask!

thanks much!

i think using loops method any. 2 suggestions:

  • you might want read on break-with-label statement; and/or
  • you might want place each menu separate function make structure clear.

Comments

Popular posts from this blog

Why does Ruby on Rails generate add a blank line to the end of a file? -

keyboard - Smiles and long press feature in Android -

node.js - Bad Request - node js ajax post -