Search code examples
automationrpaautomationanywhere

Where to find the goto statement in Automation Anywhere?


I encountered this scenario that I just need to jump to another line of code in my program using AA. Unfortunately AA does not have goto statement in command section. Is there a solution on how to use goto statement in AA?


Solution

  • AutomationAnywhere doesn't have "goto" command. Alternate options is you can create another task and use Run Task command.

    If your requirement is like

    loop(1..10)
    {
    if (num % 2 == 0)
        goto even;
    else
        goto odd;
    } 
    even:    
        echo "even";
        return; 
    odd:
        echo "odd";
        return; 
    

    You can design your AA Bot by creating 3 bots. MainBot, evenBot and oddBot.

    MainBot should be like this.

    loop(1..10)
    {
    if (num % 2 == 0)
        Run Task evenBot;
    else
        Run Task oddBot;
    }