Sektion 6. Kapitel 9
single
Challenge: Scopes
Stryg for at vise menuen
Opgave
Stryg for at begynde at kode
You want to calculate total sales for a day using local and global variables.
- Declare a global variable
grandTotal(outside any method) to store the total sales. - Create a method
AddSalethat:- Declares local variables
priceandquantity. - Calculates the total for that sale and adds it to the global
grandTotal.
- Declares local variables
Løsning
Var alt klart?
Tak for dine kommentarer!
Sektion 6. Kapitel 9
single
Spørg AI
Spørg AI
Spørg om hvad som helst eller prøv et af de foreslåede spørgsmål for at starte vores chat