Untitled

Run Settings
LanguageGroovy
Language Version
Run Command
def str = "dad" checkPalindrome(str) if (checkPalindrome_2(str)) println("Palindrome from 2nd method") else println("Not a Palindrome from 2nd method") void checkPalindrome(str) { def isPalindrome = true for (def i = 0, j = str.length() - 1; i < str.length() / 2; i++, j--) { if (str[i] != str[j]) { isPalindrome = false break } } println(isPalindrome ? "Palindrome" : "Not Palindrome") } boolean checkPalindrome_2(myString) { def length = myString.length() for (def i = 0; i < length / 2; i++) { if (myString[i] != myString[length - i - 1]) return false } true }
Editor Settings
Theme
Key bindings
Full width
Lines