I'm trying simulation in R, I want to check the probability of the person getting caught with the number of students is 40. but I get this error, Error in if (caught == "TRUE") { : the condition has length > 1. What does this error mean? How can I correct this error? TIA

```
#Initialise number of students 1:40
num_of_students <- c(1:40)
#Calculate number of exams tested - round(sqrt(length(number of students)))
num_of_exams_tested <- round(sqrt(length(num_of_students)))
#Initialise caught counter
caught_counter <- 0;
for(i in 10000){
examschecked <- sample(num_of_students, num_of_exams_tested)
#the person didn't read the paper for every 10th student
examsunmarked <- examschecked/10
#The examiner will identify an unmarked exam correctly 94% of the time
for(i in examsunmarked) {
caught <- sample(c("TRUE", "FALSE"), prob = c(0.94, 0.06))
if(caught == "TRUE"){
caught_counter <- caught_counter + 1;
}
return (caught_counter)
}
}
print((caught_counter/10000) * 100)
```