π Chapter 2: Data Types
π Integersβ
- Integer: Steven is an integer represented using binary scales. They have
scales that are either
1
or0
. Steven's value is0b101
, which is5
in decimal.
><steven> β ><{({Β°> ~
π Floating Point Numbersβ
- Floats: Steven can also be a float fysh. To seperate the integer and
decimal parts, we use a fysh bone
-
. Steven's value is5.5
.
><steven> β ><{({-{({Β°> ~
- Floats with multiple bones: Steven can also have multiple bones to
seperate each decimal place. Steven's value is
5 + 0.2 + 0.05 = 5.25
.
><steven> β ><{({-{(-{({Β°> ~
- Floats with numbers larger than 9: If a value in the decimal place is
greater than 9, it will occupy an extra decimal place. Steven's value is
15 + 0.15 + 0.005 15.155
.
><steven> β ><{{{{-{{{{-{({Β°> ~
π Stringsβ
- Strings: Steven can also be a string fysh. They speak using bubbles.
Steven's value is
"Hello, World!"
.
><steven> β π«§Hello, World!𫧠~
π¦ Arrays and Traversalβ
- Arrays: A fysh tank
[ ]
is used create an array. Each item is separated by fysh food -.value is[0b010, 0b010] = [2, 2]
.
><steven> β [><({(Β°> - ><({(Β°>] ~
- Accessing Array Elements: These fysh tanks can be traversed using a fysh
tank
[ ]
with a number inside it. Steven returns the element at index 1. Array indexes start at 0.
><steven>[><(({Β°>] ~