# Forming Code

This page will explain how to turn what you already have found (the `on join:` event and the `send` effect) into functional code. To work, code must be syntactically correct and indented properly.

***

## Syntax & indentation

The [Fundamentals category](/syntask/fundamentals.md) already covers indentation and syntax quite well. Any information here would basically be a repeat, so please head over to the [Syntax page](/syntask/fundamentals/syntax.md) and the [Indentation page](/syntask/fundamentals/indentation.md), and then, when you are done reading those continue on here.

***

## Structures

Structures are the groundwork that all other code must be built off of in Skript. All of Skripts code must be within one of these sections, unlike other languages. Structures are also mutually exclusive; only one may be used at a time (for example an event cannot be within another event).

There are three kinds of structures:

* Events
* Commands
* Functions (definitions, not calls)

{% hint style="info" %}
Commands and functions have a little more to them then events, so the Beginner's Corner will not cover them. For information on commands and functions (and a bit more information on events), see the [Structures page](/syntask/fundamentals/structures.md).

For now, as long as you aren't trying to put events inside of other events, that's all you need to know.
{% endhint %}

***

## Combining it all

Now that you're able to decipher syntax, try putting the `on join:` event into your `welcome.sk` file. Then, make sure to indent as the event opens a section. Finally, place the `send` effect within the event and send your welcome message to the `player`:

{% code overflow="wrap" lineNumbers="true" %}

```python
on join: 
  send "Welcome to the server!" to player
```

{% endcode %}

{% hint style="info" %}
Depending on your choice of syntax, your event line may look a little different, such as `on player joining:` or `on logging in:`. Of course, you can also stylise the welcome message to your liking.
{% endhint %}


---

# 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/beginners-corner/forming-code.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.
