Notice: This page requires JavaScript to function properly.
Please enable JavaScript in your browser settings or update your browser.
Leer Uitdaging: Scopes | Methoden
C# Basisprincipes

bookUitdaging: Scopes

Er zijn drie variabelen in de volgende code. Vul de lege plekken in met variabelenamen zodat de code succesvol compileert:

main.cs

main.cs

copy
1234567891011121314151617181920212223242526
using 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(___); } } }

Globaal gescope variabelen zijn toegankelijk binnen alle methoden.

main.cs

main.cs

copy
123456789101112131415161718192021222324252627282930
using 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); } } }

Was alles duidelijk?

Hoe kunnen we het verbeteren?

Bedankt voor je feedback!

Sectie 6. Hoofdstuk 9

Vraag AI

expand

Vraag AI

ChatGPT

Vraag wat u wilt of probeer een van de voorgestelde vragen om onze chat te starten.

Suggested prompts:

Can you show me the code with the blanks that need to be filled?

What are the variable names available in the code?

Can you explain more about the context or what the code is supposed to do?

bookUitdaging: Scopes

Veeg om het menu te tonen

Er zijn drie variabelen in de volgende code. Vul de lege plekken in met variabelenamen zodat de code succesvol compileert:

main.cs

main.cs

copy
1234567891011121314151617181920212223242526
using 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(___); } } }

Globaal gescope variabelen zijn toegankelijk binnen alle methoden.

main.cs

main.cs

copy
123456789101112131415161718192021222324252627282930
using 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); } } }

Was alles duidelijk?

Hoe kunnen we het verbeteren?

Bedankt voor je feedback!

Sectie 6. Hoofdstuk 9
some-alt