> For the complete documentation index, see [llms.txt](https://apwt.gitbook.io/g-pro-webontwikkeling-1/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://apwt.gitbook.io/g-pro-webontwikkeling-1/typescript/typescript-primitive-types.md).

# TypeScript: Primitive Types

## Primitive types

Onder primitieve types vallen:

* number
* bigint
* string
* boolean

```typescript
let b: boolean = true; // boolean
let n: number = 3.4; // number
let i: bigint  = 3n; // big integer
let s: string = "hallo";
```

Let op: we gebruiken bijna altijd number ipv bigint (enkel voor zeer grote getallen).

Merk op het verschil met JavaScript: een variabel heeft altijd een bepaalde type. Die geef je mee door : *typename* achter jouw variabel te plaatsen (enkel bij het definiëren van de variabel!)

```typescript
let b: boolean;
let n: number;
let i: bigint;
let s: string;
```

Strings kunnen op verschillende manieren een waarde krijgen:

```typescript
let naam: string = "Sven";
```

Hier gebruiken we de dubbele quotes om een waarde te geven.

```typescript
let familieNaam: string = 'Charleer';
```

Enkele quotes werken ook!

Maar we kunnen heel wat meer indien we **`` ` ``** (backtick) gebruiken. \
Let op, dit is niet een single quot&#x65;**`'`**.

```typescript
let zin: string = `Hallo ik ben ${naam} ${familieNaam}.`;
```

Met behulp van de `` ` `` en `${naam.van.variabel}` kunnen we de waarden van andere variabelen in onze string gebruiken.&#x20;

Dit laat ons ook toe "breaks" in onze variabel te gebruiken:

```typescript
let zin2: string = `Hallo ik ben...

ik ben ${naam}.`;
```


---

# 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:

```
GET https://apwt.gitbook.io/g-pro-webontwikkeling-1/typescript/typescript-primitive-types.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.
