Generation

generate functionWed, 19 Apr 2023

Check for the “weekday_weekend” function on each element of the vector "days", except thursday. Using for loop and break/next statements

days <- c("monday", "tuesday", "wednesday", "thursday", "friday", "saturday", "sunday") for (day in days){ if (day == "thursday"){ next } weekday_weekend(day) if (day == "friday"){ break } }

Questions about programming?Chat with your personal AI assistant