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?

    Posted by NewbieTo on 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) {
    }
    }

    NewbieTo replied 3 years, 5 months ago 1 Member · 0 Replies
  • 0 Replies

Log In to reply.

Popular Salesforce Blogs

Popular Salesforce Videos

Popular Salesforce Infographics