import console.Console def readMenuSelection() { // ... println('3: Remove an item\n') // ... println('5: Display selected items') println('6: Display one item') // ... println('11: Display selected players') println('12: Display one player\n') // ... print('\n\tEnter choice>>>> ') return Console.readInteger() } // make the Action object def action = new Action(game : new Game(name : 'The Discworld')) // make first selection def choice = readMenuSelection() while (choice != 0) { switch (choice) { case 1: // ... case 3: action.removeItem() break // ... case 5: action.displaySelectedItems() break case 6: action.displayOneItem() break // ... case 11: action.displayeSelectedPlayers() break case 12: action.displayOnePlayer() break // ... default: println "Unknown selection" } choice = readMenuSelection() } println '\n\nGame closing ... thanks for playing'