-
Notifications
You must be signed in to change notification settings - Fork 11
Learn: Basic Data Types
Julia Ogris edited this page Jun 20, 2023
·
3 revisions
Evy has three basic data types: string, num, and bool.
-
string: strings are sequences of characters enclosed in quotation marks, such as"Hello World!". -
num: numbers can be positive, negative, or have decimal points, such as123.45or-6. -
bool: booleans can only betrueorfalse.
Here are some examples of valid and invalid values for each data type:
| Type | ✅ Valid values | ❌ Invalid values |
|---|---|---|
string |
"abc", "1", ""
|
'abc', abc, "abc, "ab"c"
|
num |
123.45, -6, 0.2
|
+2, .2, "2", 1,000.3, 1 000
|
bool |
true, false
|
"true" |
The print function can print all basic data types. For example, the following code will print the string "abc", the number 123, and the boolean value true:
print "abc" 123 true
This will print the following output:
abc 123 true
👉 Note: We cannot always determine the data type of a value by its output alone.
For example, the following code will print 1 1 true true:
print "1" 1 "true" true
However, the data types are actually:
-
"1":string -
1:num -
"true":string -
true:bool
Overview | About | Playground | Gallery