Seksjon 3. Kapittel 2
single
Local vs. Global Variables
Sveip for å vise menyen
Oppgave
Sveip for å begynne å kode
Create a function that demonstrates the difference between local and global variables by modifying a global variable inside a function.
-
Use the
globalkeyword to modify the global variablexinside the function; -
Assign the value
20toxwithin the function; -
Create a local variable
yinside the function and assign it the value5.
Løsning
Alt var klart?
Takk for tilbakemeldingene dine!
Seksjon 3. Kapittel 2
single
Spør AI
Spør AI
Spør om hva du vil, eller prøv ett av de foreslåtte spørsmålene for å starte chatten vår