Activity Forums Salesforce® Discussions Can we add multiple if or if - else if statements in a try catch block?

  • Can we add multiple if or if - else if statements in a try catch block?

  • NewbieTo

    Member
    June 9, 2021 at 8:07 am

    Is something like below even possible?
    static String TEST_LINK = 'someLink/';
    static String TEST_LINK2 = 'otherLink/';
    //class method
    public someMethod(String test) {
    try {
    if (!somecondition.matches(TEST_LINK)) { return something;}
    if (!somecondition.matches(TEST_LINK2)) { return something;}
    } catch (Exception e) {
    }
    }

Viewing 1 of 1 posts

Log In to reply.

Popular Salesforce Blogs

Popular Salesforce Videos

Popular Salesforce Infographics