The value of a variable changes during the execution of the program. Example: Our robot should take 3 cars at a time. At the beginning there are 3 when he has taken the first one, only 2, then only 1, then 0. When he has packed them and comes back, there are 3 again, etc. We remember how many cars he should take in a variable: At the beginning there are 3. We write the instruction Creating a variable is called declaring. The first time a value is assigned to a variable, it is called initializing. The declaration and initialization can be done in a single step, or more. A variable must be declared and initialized before it can be used.
Variable
December 20, 2022 · 1 min · 121 words · Stephen Campbell