Hi, I want to make a switchcase statement for a chatbot I'm attempting to create, but I cannot implement the code into the Execute Code box without receiving an error code. I want the bot to use logic and create a multitude of responses based off of the string of options that the user has chosen. I've create the appropriate variables and told ChatGPT all of the responses to each variable, but it still isn't working. I have very little coding experience, so I have no clue what's wrong with it. Below is the code that isn't working.
// Assuming you have a Workflow object named 'workflow'
// Check if the WhyYouHere variable is 'quest_for_sweet'
if ("quest_for_sweet".equals(workflow.get("WhyYouHere"))) {
// Create a new message in the workflow with the given text
workflow.set("NextMsg", workflow.get("NextMsg") + "\nAh, the perfect reason to seek some sweet treasures!");
}
// Check if the WhyYouHere variable is 'explore_candies'
else if ("explore_candies".equals(workflow.get("WhyYouHere"))) {
// Create a new message in the workflow with the given text
workflow.set("NextMsg", workflow.get("NextMsg") + "\nIndulging in a little blissful nostalgia sounds like a delightful treat!");
}
// Check if the ForWhom variable is 'myself'
else if ("myself".equals(workflow.get("ForWhom"))) {
// Create a new message in the workflow with the given text
workflow.set("NextMsg", workflow.get("NextMsg") + "\nTreating yourself to some sweet delights is a wonderful idea!");
}
// Check if the ForWhom variable is 'gift'
else if ("gift".equals(workflow.get("ForWhom"))) {
// Create a new message in the workflow with the given text
workflow.set("NextMsg", workflow.get("NextMsg") + "\nSpreading joy with the gift of candies? What a sweet gesture!");
}