Solidity

如果你熟悉C这类编程语言,solidity几乎不用学

If语句


if(<bool expr>){
	cond
} else if(...){

} else {

}

循环


for (uint i = 0; i < 10; ++i){
	...
}

Contracts


类似Class,合约的基本类型

contract Name {
	...
	uint foo = 5;
	constructor(){
		// 部署时执行一次
	}
	
	function name() scope returns(type) {
		...
	}
}

简单类型


uint = 256bit | uint8, uint16, uint32, …

string 尽量不要使用strings,除非需要做这种类型数据的输出【因为基本类型是uint256】

arrays