-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathvariables.qs
More file actions
44 lines (38 loc) · 1019 Bytes
/
Copy pathvariables.qs
File metadata and controls
44 lines (38 loc) · 1019 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
# Variables
# A variable is a name for a value.
text = "Quanto"
number = 3
flag = true
nothing = null
items = ["red", "green"]
person = {
"name": "Sara",
"age": 20
}
print("text:", text)
print("number:", number)
print("flag:", flag)
print("nothing:", nothing)
print("items:", items)
print("person:", person)
print("person name:", person["name"])
# type(value) shows the data type name.
print("type text:", type(text))
print("type number:", type(number))
print("type flag:", type(flag))
print("type nothing:", type(nothing))
print("type items:", type(items))
print("type person:", type(person))
# isinstance(value, "type") checks the type.
print(isinstance(text, "string"))
print(isinstance(number, "int"))
print(isinstance(flag, "bool"))
print(isinstance(nothing, "null"))
print(isinstance(items, "list"))
print(isinstance(person, "map"))
# Names can start with a letter or "_".
_secret = "starts with underscore"
print(_secret)
# You can change a normal variable.
number = 4
print("new number:", number)