# R Booleans

Used to represent the truth or false values of a varaible or for a condition.
Generally used in conditional statements and logical operations.
Denoted by the values TRUE and FALSE

Example
``````# Boolean variables
is_true <- TRUE
is_false <- FALSE``````

## Comparison Operators

Used to compare values and return Boolean values.

Example
``````# Comparison operators
a <- 5
b <- 10

# Equality
is_equal <- a == b  # FALSE

# Inequality
not_equal <- a != b  # TRUE

# Greater than
greater_than <- a > b  # FALSE

# Less than
less_than <- a < b  # TRUE

# Greater than or equal to
greater_equal <- a >= b  # FALSE

# Less than or equal to
less_equal <- a <= b  # TRUE``````

## Logical Operators

Combine's one or more Boolean values and gives a final result.

Example
``````# Logical operators
x <- TRUE
y <- FALSE

# AND
result_and <- x & y  # FALSE

# OR
result_or <- x | y  # TRUE

# NOT
result_not <- !x  # FALSE

result_or & result_and & result_not
result_or | result_and & result_not
result_or & result_and | result_not
result_or | result_and | result_not``````

## Conditional Statements

Boolean values are commenly used in conditional statements.
They are used to check the condition and return true or false to execute a block of code in the conditional statements.

Example
``````# If statement
if (is_true) {
print("It's true!")
} else {
print("It's false!")
}``````

# Quick Recap - Topics Covered

R Booleans
Usage of Booleans in R

## Practice With Examples in Compilers

The Concepts and codes you leart practice in Compilers till you are confident of doing on your own. A Various methods of examples, concepts, codes availble in our websites. Don't know where to start Down some code examples are given for this page topic use the code and compiler.

Example 1
Example 1 Example 2 Example 3 Example 4 Example 5

FEEDBACK