Utfordring: Omfang
Det er tre variabler i følgende kode. Fyll inn de tomme feltene med variabelnavn slik at koden kompilerer uten feil:
main.cs
1234567891011121314151617181920212223242526using System; namespace ConsoleApp { class Program { static int var1 = 10; static void Main(string[] args) { int var2 = 11; if(var1 > 5) { Console.WriteLine(___); } else { int var3 = 12; Console.WriteLine(___); } } static void output() { Console.WriteLine(___); } } }
Globale variabler kan nås inne i alle metoder.
main.cs
123456789101112131415161718192021222324252627282930using System; namespace ConsoleApp { class Program { static int var1 = 10; static void Main(string[] args) { int var2 = 11; if(var1 > 5) { Console.WriteLine(var2); } else { int var3 = 12; Console.WriteLine(var3); } } static void output() { Console.WriteLine(var1); } } }
Alt var klart?
Takk for tilbakemeldingene dine!
Seksjon 6. Kapittel 9
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
Suggested prompts:
What are the names of the three variables that need to be filled in?
Can you provide the code snippet with the blanks?
Can you explain more about the context or purpose of these variables?
Awesome!
Completion rate improved to 1.59
Utfordring: Omfang
Sveip for å vise menyen
Det er tre variabler i følgende kode. Fyll inn de tomme feltene med variabelnavn slik at koden kompilerer uten feil:
main.cs
1234567891011121314151617181920212223242526using System; namespace ConsoleApp { class Program { static int var1 = 10; static void Main(string[] args) { int var2 = 11; if(var1 > 5) { Console.WriteLine(___); } else { int var3 = 12; Console.WriteLine(___); } } static void output() { Console.WriteLine(___); } } }
Globale variabler kan nås inne i alle metoder.
main.cs
123456789101112131415161718192021222324252627282930using System; namespace ConsoleApp { class Program { static int var1 = 10; static void Main(string[] args) { int var2 = 11; if(var1 > 5) { Console.WriteLine(var2); } else { int var3 = 12; Console.WriteLine(var3); } } static void output() { Console.WriteLine(var1); } } }
Alt var klart?
Takk for tilbakemeldingene dine!
Seksjon 6. Kapittel 9