Programming: Computer Programming For Beginners: Learn The Basics Of C# (Coding, C Programming, Java Programming, C# Programming, JavaScript, Python, PHP) by Joseph Connor
Author:Joseph Connor [Connor, Joseph]
Language: eng
Format: epub, azw3
Publisher: Microsoft
Published: 2016-07-26T22:00:00+00:00
Chapter 5: Loop Your Way Around C#
When you are writing software or applications, you will need to use Loops. This is an essential technique prevalent in all programming languages. A loop can be defined as a sequence of instructions which are repeated continually till a certain predefined condition is met. In simple terms, a block of code is repeated a set number of times till a condition are fulfilled.
Generally, in a loop, a certain process is performed. This can be as simple as fetching a specific data item and modifying it. After it, a condition is checked. For example, a counter can be checked to see if it has reached a specific number. If the number has not been reached, the next instruction for the program is to return to the very first instruction of the sequence. As such, the sequence is repeated. Once the condition has been fulfilled, the instruction will cause the program to proceed to the next set of sequential instructions. It can also branch out from the loop.
There is a special kind of loop known as an infinite loop. In this loop, there is an absence of a functioning exit instruction. As a result, the loop will repeat continually till it is sensed by the operating system which will terminate the program and an error will show. The infinite loop can also be stopped due to the occurrence of some other event. For example, the program can be made to terminate automatically after a specific duration of time.
In C#, you will come across four different kinds of loops. As such, you need to be familiar with them.
The While Loop
The simplest of the four loops in C# is the while loop. In this type of loop, a sequence of instructions will be executed continually as long as the defined condition returns true. It will only exit when the condition returns false. Here is an example to help you understand it.
using System;
Download
Programming: Computer Programming For Beginners: Learn The Basics Of C# (Coding, C Programming, Java Programming, C# Programming, JavaScript, Python, PHP) by Joseph Connor.azw3
This site does not store any files on its server. We only index and link to content provided by other sites. Please contact the content providers to delete copyright contents if any and email us, we'll remove relevant links or contents immediately.
Drafting & Mechanical Drawing | Fluid Dynamics |
Fracture Mechanics | Hydraulics |
Machinery | Robotics & Automation |
Tribology | Welding |
Whiskies Galore by Ian Buxton(41489)
Introduction to Aircraft Design (Cambridge Aerospace Series) by John P. Fielding(32855)
Small Unmanned Fixed-wing Aircraft Design by Andrew J. Keane Andras Sobester James P. Scanlan & András Sóbester & James P. Scanlan(32534)
Craft Beer for the Homebrewer by Michael Agnew(17902)
Turbulence by E. J. Noyes(7660)
The Complete Stick Figure Physics Tutorials by Allen Sarah(7097)
Kaplan MCAT General Chemistry Review by Kaplan(6547)
The Thirst by Nesbo Jo(6405)
Bad Blood by John Carreyrou(6245)
Modelling of Convective Heat and Mass Transfer in Rotating Flows by Igor V. Shevchuk(6200)
Learning SQL by Alan Beaulieu(5994)
Weapons of Math Destruction by Cathy O'Neil(5779)
Man-made Catastrophes and Risk Information Concealment by Dmitry Chernov & Didier Sornette(5589)
Digital Minimalism by Cal Newport;(5324)
Life 3.0: Being Human in the Age of Artificial Intelligence by Tegmark Max(5144)
iGen by Jean M. Twenge(5125)
Secrets of Antigravity Propulsion: Tesla, UFOs, and Classified Aerospace Technology by Ph.D. Paul A. Laviolette(4860)
Design of Trajectory Optimization Approach for Space Maneuver Vehicle Skip Entry Problems by Runqi Chai & Al Savvaris & Antonios Tsourdos & Senchun Chai(4806)
Electronic Devices & Circuits by Jacob Millman & Christos C. Halkias(4698)
