Data Types and Constants¶
A PyTeal expression has one of the following two data types:
Int(n) creates a
TealType.uint64 constant, where
n >= 0 and n < 2 ** 64.
A byte slice is a binary string. There are several ways to encode a byte slice in PyTeal:
Byte slices can be created from UTF-8 encoded strings. For example:
Byte slices can be created from a RFC 4648#section-8 base16 encoded
binary string, e.g.
"A21212EF". For example:
Bytes("base16", "0xA21212EF") Bytes("base16", "A21212EF") # "0x" is optional
Byte slices can be created from a RFC 4648#section-6 base32 encoded
binary string without padding, e.g.
All PyTeal expressions are type checked at construction time, for example, running
the following code triggers a
Int(0) < Arg(0)
< (overloaded Python operator, see Arithmetic Operators for more details)
requires both operands of type
Arg(0) is of type
Converting a value to its corresponding value in the other data type is supported by the following two operators:
Itob(n): generate a
TealType.bytesvalue from a
Btoi(b): generate a
TealType.uint64value from a