#is TRUE or FALSE
x <- FALSE
sprintf('x is %s', x)
## [1] "x is FALSE"
if(x==TRUE){
print('TRUE')
}else{
print('FALSE')
}
## [1] "FALSE"
#Comparing
x <- 7 > 8
sprintf('x is %s', x)
## [1] "x is FALSE"
if(x == TRUE){
print('TRUE')
}else{
print('FALSE')
}
## [1] "FALSE"
x <- 6
y <- 8
z <-9
print(x < y & z > y)
## [1] TRUE
x <- 0
sprintf('x is %s', x)
## [1] "x is 0"
sprintf(class(x))
## [1] "numeric"
if (x) {
sprintf('TRUE')
}else{
sprintf('FALSE')
}
## [1] "FALSE"
#Boolean Logic
weatherIsNice <- TRUE
haveUmbrella <- FALSE
if (!(haveUmbrella | weatherIsNice)){
print('Stay inside')
}else{
print('Go for a walk')
}
## [1] "Go for a walk"