# 智能合约-1.值和类型 **Published by:** [Murraya](https://paragraph.com/@murraya/) **Published on:** 2022-05-07 **URL:** https://paragraph.com/@murraya/1 ## Content 值和类型// SPDX-License-Identifier: MIT pragma solidity ^0.8.7; // Data type contract Valuetypes { bool public b = true; uint public u = 123; // [0, 2^256-1] 默认256位 int public i = -123; // int = int256 -2**255 to 2**255-1 int public minInt = type(int).min; int public maxInt = type(int).max; address public addr = 0x6EB72C67086D5487Dc1C27800afa6d63a3E14c75; // 16进制数字 // bytes32 public b32 = } 函数// SPDX-License-Identifier: MIT pragma solidity ^0.8.7; contract FunctionIntro { function add(uint x, uint y) external pure returns (uint){ return x + y; } function sub(uint x, uint y) external pure returns (uint){ return x - y; } } ## Publication Information - [Murraya](https://paragraph.com/@murraya/): Publication homepage - [All Posts](https://paragraph.com/@murraya/): More posts from this publication - [RSS Feed](https://api.paragraph.com/blogs/rss/@murraya): Subscribe to updates