In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-04-08 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Internet Technology >
Share
Shulou(Shulou.com)06/01 Report--
This article mainly explains "what is the basic concept of bytes". The content of the explanation is simple and clear, and it is easy to learn and understand. Please follow the editor's train of thought to study and learn "what is the basic concept of bytes".
Environment description: Ide: online remix Solidity IDE
Language: solidity solidity
Version number: 0.4.20
Sample code:
Pragma solidity ^ 0.4.20 position contract Test {bytes1 bt1 = "a"; / / byte equivalent bytes1 bytes2 bt2 = "ab"; function getbBytes () public constant returns (bytes1,bytes2) {return (bt1,bt2);} function getbBytesLength () public constant returns (uint,uint) {return (bt1.length,bt2.length);}}
The number 1 after bytes1 indicates that 1 byte bytes is equal to bytes1 by default
The number 2 after Bytes2 represents 2 bytes.
The number 3 after Bytes3 indicates 3 bytes.
The number 4 after bytes4 indicates 4 bytes.
Code parsing:
Bytes1 bt1 = "a"
Bytes2 bt2 = "ab"
Declaration defines two bytes variables, bt1 and bt2, with values of an and ab, respectively
Function getbBytes () public constant returns (bytes1,bytes2):
The function named getbBytes returns two values of type bytes1,bytes2,solidity, like golang, can return multiple values as the function returns
Return (bt1,bt2)
Two values are returned. Note that the value returned here will be expressed as ASCII. The next section will talk about type conversion.
Function getbBytesLength () public constant returns (uint,uint):
Returns the length of two bytes types using the length attribute: return (bt1.length,bt2.length)
Thank you for your reading, the above is the content of "what is the basic concept of bytes", after the study of this article, I believe you have a deeper understanding of what the basic concept of bytes is, and the specific use needs to be verified in practice. Here is, the editor will push for you more related knowledge points of the article, welcome to follow!
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.