You’ve made it this far! Well done! Starting with arrays, we can already say we have a very basic knowledge of C# programming. Still a long path ahead of us, but we are no longer n00bs. We now know the fundamental things of (almost) any programming language and we can write basic programs.… Read more
Arrays
January 18th, 2017Nested loops
January 17th, 2017Nested loops are programming concepts consisting of two or more loops placed one into the other. The innermost loop is executed the most times, while the outermost, the least times. This is because the inner loops have to perform all of their cycling for every cycle of their next outer loop.… Read more
Continue operator
January 16th, 2017In the last article, we spoke about the Break operator being used to immediately stop a loop and continue the execution with the statements that follow after the loop. The Continue operator works somehow in the same way, with the only difference that it will only make the execution skip the current iteration of the loop.… Read more
Break operator
January 16th, 2017The break operator is used whenever we want to end a loop immediately, even before ending its execution in a natural way. Whenever the Break operator is met, the execution of the loop is immediately stopped and the program continues executing the first instruction that follows after the loop.… Read more
Foreach loop
January 14th, 2017The foreach loop is significantly more simpler than the For loop, but it’s also harder for the readers of this blog, since it’s based on concepts we haven’t learned yet. For this reason, i will simply tell you that a foreach loop was designed to iterate through all elements of an array, list or any other collection of elements that implement IEnumerable interface.… Read more
For loop
January 14th, 2017For loop is a kind of repeating code construct which is a bit more complex than the previous types of loops we learned so far. On the other hand, they can solve more complicated tasks, with less code involved.
The syntax of the For instruction is the following:
1 2 3 4 |
for (start_value; end_condition; increment_value) { instructions; } |
When the program repeats (cycles) the instructions for a certain number of times, you will usually use a variable called control variable, which indicates how many times you executed the instructions.… Read more
Do While loop
January 13th, 2017The Do While loop is used any time we want to make sure that the instructions will be executed at least once, even if the condition of the loop evaluates as False. As we learned in the previous lesson, a loop is a construct that lets us run one or more instructions repeatedly, until a condition is evaluated as False.… Read more
While loop
January 13th, 2017Loops are a special kind of instructions that repeat a piece of code a specific number of times or until a special condition becomes True. There are also loops that never end, called infinite loops, and they are rather errors than useful code.… Read more
Conditional statement Switch
January 9th, 2017As we will see, conditional statement Switch works very much like the If-Else If-Else statement, with only a syntax difference. It executes an instruction based on the calculated value of a condition. The format of the Switch statement is the following:
Nested If statements
January 8th, 2017Sometimes in your programs, you will need to perform checks inside other checks. These kind of conditional processing are called nested If statements or nested If-Else statements.
In common words, nesting is the process of placing a concept inside another concept.… Read more