logotransparent.png

Legion of Learners

www.lol-101.com

  • Home

  • Classrooms

  • Courses

  • About Us

    • Executive Team
    • Board Members
  • Resources

  • More

    Use tab to navigate through the menu items.
    To see this working, head to your live site.
    • Categories
    • All Posts
    • My Posts
    sfolax6776
    Jun 27, 2019
      ·  Edited: Nov 09, 2019

    5.4 Can we exit a loop early if something happens?

    in Introduction to Java

    A. Introduction

    There are occasions that we might need to terminate a loop prematurely. There two statements for this purpose. Please note they apply not only for for-loops, but also for while-loops and do-loops.

    B. Watch (Slides)

    C. Try: to print out all prime numbers that are less than 100, do you need to use break or continue statements? Can your program achieve the same goal without using them?


    0 comments
    0
    0 comments

    Questions? Email us at legionoflearners@gmail.com or join our WeChat group!

    • lol-101dotcom

    ©2020 Legion of Learners