# Syntax

Syntax is a vital part of not only Skript, but all programming languages.&#x20;

Syntax is to coding what grammar is to a language; syntax is the template of code. Syntax defines how code must be formed, written, and interpreted.

{% hint style="info" %}
**"What is syntax?"**\
Syntax is the structural rules for writing code. These rules define how a line must be written and used in order for Skript to understand the intent behind it.

**"Why do I need to follow syntax rules?"**\
Skript can't read minds and guess what someone tries to code, so standardised methods are enforced. This makes sure everyone writes code in a uniform and consistent way that is guaranteed to be understandable to Skript.
{% endhint %}

The correct syntax can always be found on the documentation; every single aspect of Skript's code will have its syntax showcased on a documentation page. These pages can also come with helpful examples and iterations of it in use.

{% hint style="info" %}
For links to the documentation, see the [Documentation & Wikis page](/syntask/resources/documentation-and-wikis.md).
{% endhint %}

***

## Reading Syntax

When you first start, reading syntax can be quite confusing, as there's lots of symbols. However, once you learn what those symbols mean it becomes a lot easier to decipher syntax.

For Skript, the syntax will be governed by the following symbols:

### Parentheses & vertical bars

Parentheses (`( )`) will surround options; a place where you need to pick one of the contents. All choices will be separated by a vertical bar (`|`).

Example: `player's (tool|held item|weapon)`

Here, when using the expression for the item a player is holding, we are given some options: `player's tool`, `player's held item`, and `player's weapon`. All three of these will work the same, although it's recommended you use `player's tool` as it's the shortest and most popular.

### Square brackets

Omittable elements of a line are surrounded by square brackets (`[ ]`). This means that in some cases you may not want or even need these parts, and can exclude or ignore them. This could be to cut down wordiness or to remove an aspect irrelevant in a scenario.

Example: `[the] (x|y|z)(-| )(coord[inate]|pos[ition]|loc[ation])[s] of %locations%`

This expression for the specific coordinate has a bunch of omittable things. You can remove the starting `the` for no effect on the code, and you can use `coord`, `pos`, and `loc` instead of the full forms `coordinate`, `position`, and `location`.

### Percentage signs

Last, but certaintly not least, are percentage signs (`%`). Inside percentages you will need to specify a value by inputting an object, or sometimes, many objects.

Example: `send %string(s)% to %reciever(s)%`

In this line, there are two places to input things: the message(s) we want to send, and whomever we want to receive them, such as `send "Hello there!" to player and {_someoneElse}`.\
-> Here, `"Hello there!"` is the message or string, and `player` as well as `{_someoneElse}` are the receivers.


---

# 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://x8ight.gitbook.io/syntask/fundamentals/syntax.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.
