User Tools

Site Tools


atelier:coding_gouter:ppour:variables

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
atelier:coding_gouter:ppour:variables [2026-04-22 15:07] – removed - external edit (Unknown date) 127.0.0.1atelier:coding_gouter:ppour:variables [2026-04-22 15:09] (current) Andrii Kurdiumov
Line 1: Line 1:
 +====== Variables ======
  
 +The variables is things where you can have some values, like numbers, text, maybe more complex things like pictures, files, links, video, etc. You can say that anything can be stored in variables, but usually there following ways how variables are used.
 +
 +{{tablelayout?rowsHeaderSource=Auto}}
 +^ Role                ^ Description                                                                                                                        ^
 +| Fixed value         | Initialized once and not changed thereafter.                                                                                       |
 +| Stepper             | Steps through a systematic, predictable succession of values (e.g., a loop counter).                                               |
 +| Walker              | Traverses a data structure element by element, where each new value depends on the previous position.                              |
 +| Follower            | Always receives the previous value of some other variable (e.g., prev = current before current is updated).                        |
 +| Most-recent holder  | Holds the latest value encountered in an unpredictable series, typically successive inputs.                                        |
 +| Most-wanted holder  | Holds the best value found so far (e.g., maximum or minimum).                                                                      |
 +| Gatherer            | Accumulates the combined effect of individual values (e.g., running sum or count).                                                 |
 +| One-way flag        | A two-valued variable that, once changed from its initial value, never reverts (e.g., an error flag set to True and never reset).  |
 +| Temporary           | Holds a value for a very short time only, most commonly in a swap operation.                                                       |
 +| Organizer           | A collection used only to rearrange its elements (e.g., sorted in place), never to add or remove them.                             |
 +| Container           | A collection whose elements are added and/or removed during the computation.                                                       |
 +
 +We will eventually show each of this usage during the course.
 +
 +Example of variable declaration and usage
 +
 +<code>
 +a = 10
 +b = 100
 +afficher("Somme =", a + b)
 +afficher("Produit =", a * b)
 +x = 4
 +y = x*x - 9*x + 14
 +afficher("x = ", x)
 +afficher("y = x*x - 9*x + 14")
 +afficher("y = ", y)
 +</code>