Skip to content

Commit afa7147

Browse files
Update create.md
1 parent 10aea29 commit afa7147

1 file changed

Lines changed: 15 additions & 2 deletions

File tree

docs/reference/buffer/create.md

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,19 @@
11
## create
2-
allocates a new buffer in a fixed size of bytes.
2+
allocates a new buffer in a fixed size of [bytes](https://github.com/DeveloperTryingToCodeLikeOtherOfThem/pxt-hardware-programming-docs/blob/master/docs/bytes.md).
33
``` sig
44
Buffer.create(null);
55
```
6-
A **buffer** is contiguous memory.
6+
A **buffer** is a block of contiguous memory.
7+
8+
Additionally, when allocating a buffer, there is no meaning to represent the bytes.
9+
This is because allocating the buffer is simply storing the amount of memory into the RAM (Random Access Memory).
10+
11+
The meaning comes from from how you write or read the bytes, such as using:
12+
* `buf[index] = value` to set a byte at a specific offset
13+
* Buffer methods like setNumber to store structured values
14+
15+
## Example
16+
Store 100 bytes.
17+
``` ts
18+
const buf = Buffer.create(100);
19+
```

0 commit comments

Comments
 (0)