< A Beginner's Guide to D < Conditions and Loops

Programmers familiar with C, C++ or Java are likely to find this section familiar, and may want to skim or skip it at their discretion.

At this point, you should know how to do some simple interaction with the user. But without conditions or loops, your programs can only follow one simple pattern.

One fundamental capability of any programming language is conditions. A condition statement, such as an if statement, causes different code to run depending on whether a condition is true or false. if statements will be introduced in the following section.

Another important ability is a loop. It's often necessary to make one section of code run multiple times. The foreach, for and while loops allow this. They will be introduced later in this chapter.

This article is issued from Wikibooks. The text is licensed under Creative Commons - Attribution - Sharealike. Additional terms may apply for the media files.