Return Multiple Values and get into another function in Solidity


Normally we find a method in which we only able to return a single entity like this one, but in solidity we can return multiple values and get them in other function or also view that values.

Function getValue(){
      return “some Value”;
}

Here is the example of returning multiple values:

// SPDX-License-Identifier: GPL-3.0
pragma solidity >=0.7.0 <0.9.0;
contract basic{
    uint number = 10;
    bool boolean = true;
    
    string name= "John";
    
    function getValues()public view returns( uint, bool, string memory){
        return ( number, boolean, name);
    }
    function getReturnedValues() public view returns(uint, bool, string memory){
        uint _number;
        bool _boolean;
        string memory _name;
        //getting values
        ( _number, _boolean, _name) = getValues();
        
        return ( _number, _boolean, _name);
    }
}