Vyne Documentation
Version 1.5.2 | Last updated: June 2023
Variables & Data types
These are the data types supported by Vyne.
| Type | Description | Example |
|---|---|---|
| Number | Any integer and floating number. | age = 30 ; score = 87.4 etc. |
| String | Character sequence | "Hello World!" etc. |
| Boolean | Logical variables | true ; false |
| Array | Dynamic list | scores = ["AA", "CD", "BA", 3.3] |
Note
Arrays can hold any data type.
Numbers
Numbers in Vyne contain both decimal digits and integers. You can declare a number variable with this syntax.
Simple Example
main.vy
// variableName :: Type = value
age :: Number = 30 //integer
GPA :: Number = 3.42 //floating number
Note
There is another way called inferred declaration to declare any variable with the same syntax. With that, you don't need to tell code the variable type, Vyne automatically sets it for you.
Simple Example
main.vy
// variableName = value
age = 30 //integer
GPA = 3.42 //floating number
Arithmetic
Vyne supports following arithmetic operations for numbers.
| Symbol | Operation | Example |
|---|---|---|
+ |
Sums values | total :: Number = 23.14 + 2.86 |
- |
Subtracts vaues | change :: Number = 50 - 26 |
* |
Multiplies values | fiveBucks :: Number = 5 * 1000 |
/ |
Divides values | average :: Number = 48 / 6 |
< / > / == |
Checks if one value is less, more or equal | lessThan :: Bool = 5 < 10 |