Notice: This page requires JavaScript to function properly.
Please enable JavaScript in your browser settings or update your browser.
Leer Uitdaging: If-Voorwaarde | Controle Structuren
C# Basisprincipes

bookUitdaging: If-Voorwaarde

Schrijf een if-voorwaarde die controleert of de variabele x binnen het bereik van 40 tot 70 ligt (inclusief 40 en 70). Gebruik de operatoren <= voor vergelijking. Als de voorwaarde waar is, moet het "In Range" weergeven.

main.cs

main.cs

copy
12345678910111213141516
using System; namespace ConsoleApp { class Program { static void Main(string[] args) { int x = 55; // Write code below this line // Write code above this line } } }

De syntaxis van een if-voorwaarde is: if(condition) { /* code to execute */ }

main.cs

main.cs

copy
1234567891011121314151617181920
using System; namespace ConsoleApp { class Program { static void Main(string[] args) { int x = 55; // Write code below this line if (40 <= x && x <= 70) { Console.WriteLine("In Range"); } // Write code above this line } } }

Was alles duidelijk?

Hoe kunnen we het verbeteren?

Bedankt voor je feedback!

Sectie 3. Hoofdstuk 6

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 an example using a specific value for x?

Can you explain how the if-condition works in this case?

What happens if x is outside the range?

Awesome!

Completion rate improved to 1.59

bookUitdaging: If-Voorwaarde

Veeg om het menu te tonen

Schrijf een if-voorwaarde die controleert of de variabele x binnen het bereik van 40 tot 70 ligt (inclusief 40 en 70). Gebruik de operatoren <= voor vergelijking. Als de voorwaarde waar is, moet het "In Range" weergeven.

main.cs

main.cs

copy
12345678910111213141516
using System; namespace ConsoleApp { class Program { static void Main(string[] args) { int x = 55; // Write code below this line // Write code above this line } } }

De syntaxis van een if-voorwaarde is: if(condition) { /* code to execute */ }

main.cs

main.cs

copy
1234567891011121314151617181920
using System; namespace ConsoleApp { class Program { static void Main(string[] args) { int x = 55; // Write code below this line if (40 <= x && x <= 70) { Console.WriteLine("In Range"); } // Write code above this line } } }

Was alles duidelijk?

Hoe kunnen we het verbeteren?

Bedankt voor je feedback!

Sectie 3. Hoofdstuk 6
some-alt