> For the complete documentation index, see [llms.txt](https://guide.form.gov.sg/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://guide.form.gov.sg/user-guides/advanced-guide/logic.md).

# Logic

![](https://4000418884-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FPFgP7DGKSubWBlNdSCQd%2Fuploads%2FBJl6Mdya3kP444lv6TaR%2FLogic-%5Bcopy%5D.gif?alt=media\&token=f0a05136-b55b-495b-a93b-ebbd43da1d1e)

You can show or hide fields or disable form submission for invalid answers depending on user selection/input. See examples on how to apply conditional logic to your form below:

{% embed url="<https://form.gov.sg/63805d282d7633001114c34a>" %}

{% embed url="<https://form.gov.sg/64e366ca72aa130012c2eb98>" %}

{% tabs %}
{% tab title="Text Tutorial" %}

#### <img src="https://4000418884-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FPFgP7DGKSubWBlNdSCQd%2Fuploads%2FHvQoMuH9RPvCWZOfX8bW%2FText%20tutorial.jpeg?alt=media&amp;token=14ec1731-d8f5-4150-b18a-b90da084dc36" alt="" data-size="line"> Text Tutorial: Logic

**Step 1:** To the left of your form, click on this symbol <img src="https://4000418884-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FPFgP7DGKSubWBlNdSCQd%2Fuploads%2FfaY3S403GBlMN6FM6TaE%2FScreenshot%202022-09-06%20at%205.44.24%20PM.png?alt=media&amp;token=38127a67-deb2-4873-86d3-bce83c0f377e" alt="" data-size="line">.

![](https://4000418884-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FPFgP7DGKSubWBlNdSCQd%2Fuploads%2FFsG1rcx1xJRFn7kHDh6R%2Fimage.png?alt=media\&token=60cedf2a-953f-4562-a4dd-098d0e0b285b)

**Step 2:** Press the "Add Logic" button.

![](https://4000418884-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FPFgP7DGKSubWBlNdSCQd%2Fuploads%2FSdqTqfNohvyB6q0o5Sd5%2Fimage.png?alt=media\&token=5a09b20a-5c20-4edc-9891-ed0762598fd5)

**Step 3: Customise Logic**

* **A - Choose allowed fields to apply logic** -> Radio, Rating, Number, Decimal, Dropdown and Yes/No fields only.
* **B - Choose condition** -> Depending on field chosen, conditions will differ.
* **C - Add multiple conditions**: conditions within the same logic block work as AND (all conditions must be met). To set up an OR condition, create a separate logic block for each condition instead.
* **D - Choose what happens** -> Choose what fields to display or disable submission
* **E - Finish creating logic**

![](https://4000418884-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FPFgP7DGKSubWBlNdSCQd%2Fuploads%2FuoHN8jlS9c9YtKiepp5h%2FScreenshot%202022-09-25%20at%2011.33.25%20AM.png?alt=media\&token=66902b08-faee-4a5f-86bc-c586de720ea4)
{% endtab %}
{% endtabs %}


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## 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, and the optional `goal` query parameter:

```
GET https://guide.form.gov.sg/user-guides/advanced-guide/logic.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

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.
