Notice: This page requires JavaScript to function properly.
Please enable JavaScript in your browser settings or update your browser.
Lernen Boolesche Werte | Umgang mit Datentypen
Quizzes & Challenges
Quizzes
Challenges
/
C# Grundlagen

bookBoolesche Werte

Boolean data type represents two logical values true and false. The keyword bool can be used to create a Boolean variable:

main.cs

main.cs

copy
12345678910111213141516
using System; namespace ConsoleApp { internal class Program { static void Main(string[] args) { bool isOnline = true; Console.WriteLine(isOnline); // Output: True isOnline = false; Console.WriteLine(isOnline); // Output: False } } }

Logical values are used especially where we want to execute a piece of code based on a specific condition. We will learn more about conditional statements in the next section.

question mark

What will be the output of the following program?

Select the correct answer

War alles klar?

Wie können wir es verbessern?

Danke für Ihr Feedback!

Abschnitt 2. Kapitel 4

Fragen Sie AI

expand

Fragen Sie AI

ChatGPT

Fragen Sie alles oder probieren Sie eine der vorgeschlagenen Fragen, um unser Gespräch zu beginnen

Suggested prompts:

What are some common use cases for Boolean variables in C#?

Can you explain how logical operators work with Booleans in C#?

Can you show an example of using Booleans in an if statement?

bookBoolesche Werte

Swipe um das Menü anzuzeigen

Boolean data type represents two logical values true and false. The keyword bool can be used to create a Boolean variable:

main.cs

main.cs

copy
12345678910111213141516
using System; namespace ConsoleApp { internal class Program { static void Main(string[] args) { bool isOnline = true; Console.WriteLine(isOnline); // Output: True isOnline = false; Console.WriteLine(isOnline); // Output: False } } }

Logical values are used especially where we want to execute a piece of code based on a specific condition. We will learn more about conditional statements in the next section.

question mark

What will be the output of the following program?

Select the correct answer

War alles klar?

Wie können wir es verbessern?

Danke für Ihr Feedback!

Abschnitt 2. Kapitel 4
some-alt