我如何获得此for循环再次运行?爪哇

时间:2018-10-17 01:14:29

标签: java loops for-loop while-loop

//我希望此代码在运行后重复。例如,在我问“你想再玩一次吗?”之后如果输入1,我希望代码再次运行。

导入java.util.Scanner;

公共类MadlibsRevised {     公共静态void主(String [] args){

library(tidyverse)

SWTGQuery <- tibble(
  PARK = "BEEBE",
  WEA = c(
  "01WEA82345", "01WEA82345", "01WEA82345",
  "05WEA82341", "05WEA82341", "05WEA82341",
  "13WEA82316", "13WEA82316", "14WEA82321", "16WEA82319"
  ),
  CODE = c(
  "FM1142", "FM1142", "FM1142", "FM400", "FM700",
  "FM700", "FM545", "FM545", "FM359", "FM400"
  )
)

Sick_WTG_USA <- SWTGQuery %>% 
  group_by(PARK, WEA, CODE) %>% 
  arrange(PARK, WEA, CODE) %>% 
  summarise(FMcount = n())

Sick_WTG_USA
#> # A tibble: 6 x 4
#> # Groups:   PARK, WEA [?]
#>   PARK  WEA        CODE   FMcount
#>   <chr> <chr>      <chr>    <int>
#> 1 BEEBE 01WEA82345 FM1142       3
#> 2 BEEBE 05WEA82341 FM400        1
#> 3 BEEBE 05WEA82341 FM700        2
#> 4 BEEBE 13WEA82316 FM545        2
#> 5 BEEBE 14WEA82321 FM359        1
#> 6 BEEBE 16WEA82319 FM400        1

1 个答案:

答案 0 :(得分:-1)

只需在打印“是否要再次播放?”(在第一个while循环中)后添加此内容即可:

gameStart = input.nextInt();