# Method precedence

Method precedence is controlled by the following two method separators: `.` and `->`.

```ruby
1 + 25.sqrt      # means: 1 + sqrt(25)
1 + 25->sqrt     # means: sqrt(1 + 25)
```

The rules are the following:

* `.` binds the method to the object which precedes the dot
* `->` makes everything from its left-side an expression and applies the method on the result

The infix backslash (`\`) removes any leading or trailing whitespace at that current position and it's useful for expanding method calls on multiple lines:

```ruby
say "abc".uc      \
         .reverse \
         .chars
```

is equivalent with:

```ruby
say "abc".uc.reverse.chars
```


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://trizen.gitbook.io/sidef-lang/syntax_and_semantics/method_precedence.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
