Please Help in 40 Tutorial
Post a Reply
|Oldest Newest Rating|
· December 25, 2015
Consider that a computer programming language is a sequence of instructions for a computer to follow. It's analogous to a cooking recipe.
In all languages, there are language structures. Cooking languages typically have two: sequence and repetition. When steps appear one after another, that is sequence, the most basic to understand of language structures.
The sequence language structure also exists in programming languages. We write our programs as a sequence of instructions to be executed in order. The next language structure is selection (the one you've asked about). As an analogue, consider what you do when you go shopping for fresh produce at the supermarket. You inspect the produce, if it has any signs of decay you put it back. Otherwise you put it into your basket. You could write this as:
In cooking recipes, we also have statements like "heat at 180 celsius for 60 minutes or until golden brown". The structure of this statement is repetition. It implies that you need to repeatedly check the temperature, until you've determined that it is 180 celsius (or we preheat for fifteen minutes if we don't have a thermometer in our ovens)... Then it implies that you need to repeatedly check the time (or visually inspect the food) to determine whether it's cooked. We could write such statements like:
... and we will finish shopping only after our food is burnt
· December 26, 2015
Linguist Llama. It really makes Sense and seriously I enjoyed your answer . But I think you are trying to teach me about if else and while statements. I know these. I just couldn't understand the working of if statement in this program. By the way thanks for the answer
One of the most popular languages of all time.
|Bucky Roberts Administrator|