Peera.

Bài viết

Chia sẻ kiến thức của bạn.

0xcb24...c50e.Peera.
Dành choAll Things Web3Aug 25, 2022
Hỏi đáp Chuyên Gia

Are there signed integers in Move?

I am learning Move language. I see that it only has unsigned integer types as u8, u64 and u128. What should I do if need signed integers?

  • move
0
1
Chia sẻ
Bình luận
.

Câu trả lời

1
marsell.
Oct 27 2022, 14:09

Integers Move supports three unsigned integer types: u8, u64, and u128. Values of these types range from 0 to a maximum that depends on the size of the type.

Type Value Range Unsigned 8-bit integer, u8 0 to 28 - 1 Unsigned 64-bit integer, u64 0 to 264 - 1 Unsigned 128-bit integer, u128 0 to 2128 - 1 Literals Literal values for these types are specified either as a sequence of digits (e.g.,112) or as hex literals, e.g., 0xFF. The type of the literal can optionally be added as a suffix, e.g., 112u8. If the type is not specified, the compiler will try to infer the type from the context where the literal is used. If the type cannot be inferred, it is assumed to be u64.

If a literal is too large for its specified (or inferred) size range, an error is reported.

0
Bình luận
.

Bạn có biết câu trả lời không?

Hãy đăng nhập và chia sẻ nó.

Web3 (also known as Web 3.0) is an idea for a new iteration of the World Wide Web which incorporates concepts such as decentralization, blockchain technologies, and token-based economics.

142Bài viết198Câu trả lời
Sui.X.Peera.

Kiếm phần của bạn từ 1000 Sui

Tích lũy điểm danh tiếng và nhận phần thưởng khi giúp cộng đồng Sui phát triển.

Chiến dịch phần thưởngTháng Sáu
Chúng tôi sử dụng cookie để đảm bảo bạn có trải nghiệm tốt nhất trên trang web của chúng tôi.
Thêm thông tin