# Learn Solidity Series 2: multiple returns

By [Renaissance Labs](https://paragraph.com/@renaissance-labs) · 2022-02-25

---

![Solidity Series](https://storage.googleapis.com/papyrus_images/b579a47723b368f62110ca4e3442142720bd232ee9e396b07ea5ec370262301a.png)

Solidity Series

> 在Solidity中一个[函数](https://so.csdn.net/so/search?q=%E5%87%BD%E6%95%B0&spm=1001.2101.3001.7020)方法是可以返回多个结果的

    pragma solidity ^0.5.10;
    
    contract ManyReturns{
    
        // 基础方法：返回多个参数，用于被调用
        function getThreeNum() public returns(uint one,uint two, uint three){
            uint one = 1;
            uint two = 2;
            uint three = 3;
            return(one,two,three);
        }
    
        // 场景一：接收全部参数
        function call() public {
            uint one;
            uint two;
            uint three;
            // 接收结果的变量必须实现定义完成
            (one,two,three) = getThreeNum();
        }
    
        // 场景二：接收部分参数
        function call1() public{
            uint one;
            uint two;
            // 定义部分参数进行接收，未接收的参数，直接用逗号","分割即可。
            (one,two,) = getThreeNum();
        }
    }

---

*Originally published on [Renaissance Labs](https://paragraph.com/@renaissance-labs/learn-solidity-series-2-multiple-returns)*
