Lecture Notes on Boolean Types and Operators

0.0(0)
studied byStudied by 0 people
learnLearn
examPractice Test
spaced repetitionSpaced Repetition
heart puzzleMatch
flashcardsFlashcards
Card Sorting

1/18

flashcard set

Earn XP

Description and Tags

Flashcards covering key concepts related to Boolean types and operators in C#.

Study Analytics
Name
Mastery
Learn
Test
Matching
Spaced

No study sessions yet.

19 Terms

1
New cards

Boolean Type

A data type whose values can only be true or false.

2
New cards

Boolean Declaration

Can be declared using 'System.Boolean' or the 'bool' keyword.

3
New cards

Default Value of Booleans

False.

4
New cards

Less Than Operator

Specifies if the left hand side is less than the right hand side.

5
New cards

Greater Than Operator

Specifies if the left hand side is greater than the right hand side.

6
New cards

Less Than or Equal To Operator

Specifies if the left hand side is less than or equal to the right hand side.

7
New cards

Greater Than or Equal To Operator

Specifies if the left hand side is greater than or equal to the right hand side.

8
New cards

Equal To Operator

Checks if both sides are equal (equivalence operator). Uses two equal signs (==).

9
New cards

Not Equal Operator

Checks if both sides are not equal. Uses an exclamation mark followed by an equal sign (!=).

10
New cards

AND Operator

Returns true only if both operands are true.

11
New cards

OR Operator

Returns true if either or both operands are true.

12
New cards

Exclusive OR (XOR) Operator

Returns true if only one of the operands is true, but not if both are true.

13
New cards

AND Operators in C

Represented by one or two ampersand symbols (& or &&).

14
New cards

OR Operators in C

Represented by one or two pipe symbols (| or ||).

15
New cards

Exclusive OR Operator in C

Represented by the caret symbol (^).

16
New cards

Short Circuit Evaluation

Using double symbols (&&, ||) allows for short circuit evaluation, meaning the right hand side of an expression may not need to be evaluated.

17
New cards

Collecting Boolean Value from User

The user can enter 'true' or 'false' (in any case), but cannot enter similar values like 'yes' or 'no'.

18
New cards

Converting String to Boolean

Can be done using the 'Convert.ToBoolean' method or the 'Boolean.Parse' method.

19
New cards

Boolean to String Conversion

A Boolean can only be converted to a string, not an integral number. Achieved using string formatting methods.