Notice: This page requires JavaScript to function properly.
Please enable JavaScript in your browser settings or update your browser.
Learn Booleans | Dealing with Data Types
C# Basics

bookBooleans

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

Everything was clear?

How can we improve it?

Thanks for your feedback!

SectionΒ 2. ChapterΒ 4

Ask AI

expand

Ask AI

ChatGPT

Ask anything or try one of the suggested questions to begin our chat

Awesome!

Completion rate improved to 1.59

bookBooleans

Swipe to show menu

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

Everything was clear?

How can we improve it?

Thanks for your feedback!

SectionΒ 2. ChapterΒ 4
some-alt