Hint 2.8a

Programmeringsteknik

(Skillnad mellan versioner)
Hoppa till: navigering, sök
(Ny sida: {{NAVCONTENT_START}} If you add 1 to 40 you get 41, {{NAVCONTENT_STEP}} and if you add 1 to 41 you get the answer 42. {{NAVCONTENT_STOP}})
Rad 1: Rad 1:
{{NAVCONTENT_START}}
{{NAVCONTENT_START}}
-
If you add 1 to 40 you get 41,
+
En while-sats exekverar de närmast följande indenterade satserna efter kolon så länge som variabeln villkoret är sant.
{{NAVCONTENT_STEP}}
{{NAVCONTENT_STEP}}
-
and if you add 1 to 41 you get the answer 42.
+
<code>i</code> är vår räknare. Ifall vi inte initierar den så får vi följande felmeddelande: <code>NameError: name 'i' is not defined</code>
 +
{{NAVCONTENT_STEP}}
 +
Är WHILE detsamma som while?
{{NAVCONTENT_STOP}}
{{NAVCONTENT_STOP}}

Versionen från 5 april 2012 kl. 09.54