bool_to_word <- function(bool){
ifelse(bool, "Yes", "No")
}8 Convert boolean values to strings ‘Yes’ or ‘No’
8kyu Tantangan #8/366 - 22 Feb 2024
https://www.codewars.com/kata/53369039d7ab3ac506000467
8.1 Instruction
Complete the method that takes a boolean value and return a "Yes" string for true, or a "No" string for false.
8.2 YouTube Video
8.3 Solution Code
Solusi bar-bar
8.4 Test
library(testthat)
test_that('Basic tests', {
expect_equal(bool_to_word(TRUE), 'Yes')
expect_equal(bool_to_word(FALSE), 'No')
})Test passed 🌈
