DEV Community

Discussion on: Which types of loops are most popular in the programming languages you use?

Collapse
 
olegthelilfix profile image
Oleg Aleksandrov

Loop is boring, and recursion is my choice.
hehe)

  void printNextValue(int index, List<String> list) {
        if (list.size() == index) {
            return;
        }

        System.out.println(list.get(index));

        printNextValue(++index, list);
    }