> For the complete documentation index, see [llms.txt](https://trizen.gitbook.io/sidef-lang/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://trizen.gitbook.io/sidef-lang/programming_tasks/p/palindrome_detection.md).

# Palindrome detection

*Built-in*

```ruby
say "noon".is_palindrome    # true
```

*Non-recursive*

```ruby
func palindrome(s) {
    s == s.reverse
}
```

*Recursive*

```ruby
func palindrome(s) {
    if (s.len <= 1) {
        true
    }
    elsif (s.first != s.last) {
        false
    }
    else {
        __FUNC__(s.first(-1).last(-1))
    }
}
```
