Loop user input until conditions met

前端 未结 3 1742
盖世英雄少女心
盖世英雄少女心 2020-11-29 12:44

I need to ask the user to input a number to be used as the start of a range, and then input another number that is the end of the range. The start number has to be 0 or grea

3条回答
  •  囚心锁ツ
    2020-11-29 13:22

    You need to use a while, something like:

    while conditionsMet is false
        // gather input and verify
        if user input valid then
            conditionsMet = true;
    end loop
    

    should do it.

提交回复
热议问题