Datatypes
ASnake Documentation
Summary:
Datatypes are information that a Python interpreter or compiler can use to compute. This is the very basics, and a fundamental which all Python code, and thus ASnake code, will rely on.
If you are aware already of Python datatypes, you can skip this page. However, bool is slightly different.
There are more datatypes than this page will cover. The official documentation on these datatypes are here:
https://docs.python.org/3/library/datatypes.html
Scalar types:
Represents a single value.
Syntax int:
Stands for integer. It is any number.
123
-12
Try this code ➤Can be represented as hexidecimal or octal, if you're a nerd.
0xFF
0o11
Try this code ➤Syntax float:
Stands for floating point. It's a decimal. Integers and decimals are separate, though they often intermix when operating upon them.
12.1242
-3.14
Try this code ➤Syntax str:
Stands for string. It's text!
"It look's something like this"
'or this'
"""Or this if you wish to have
multiline text, which can be useful sometimes."""
"1234"
Try this code ➤Syntax bool:
Any expression results in a result which is True, False, or even None. The primary purpose of this is for conditionally executing blocks of code when comparing.
In ASnake, it does not matter if these values are capitalized.
true
FALSE
None
Try this code ➤Iterable types:
Iterables can be iterated upon by loops or have individual elements accessed by indexes.
Syntax list:
An extendable array of other datatypes.
['this', 12, "is", 6.999999999 , """A LIST!"""]
Try this code ➤Syntax tuple:
An array similar to a list, but non-modifiable. It can accept any datatype.
('123',12.345,"this is a tuple")
Try this code ➤Syntax dict:
Stands for dictionary. You can have a int or str represent any datatype, including a list and dict.
{'ASnake':"is a transpiled language", "My favorite number is": 12, 9:[1,2,3,4,5,6,7,8,9]}
Try this code ➤