Skip to content

Commit

Permalink
Added tutorial 20
Browse files Browse the repository at this point in the history
  • Loading branch information
willitscale committed Oct 22, 2017
1 parent b7c5dbc commit 861715b
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 0 deletions.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ The companion to the Youtube tutorials
- [Learning Solidity : Tutorial 17 Polymorphism](https://www.youtube.com/watch?v=l_E5F5qnbtk)
- [Learning Solidity : Tutorial 18 Randomness and Gambling](https://www.youtube.com/watch?v=3wY5PRliphE)
- [Learning Solidity : Tutorial 19 Nested Arrays and Storage](https://www.youtube.com/watch?v=zkNHRJEuYQg)
- [Learning Solidity : Tutorial 20 Parameter Mapping and Multiple Return Values](https://www.youtube.com/watch?v=v3aoiTh-UVQ)

### Support

Expand Down
23 changes: 23 additions & 0 deletions tutorial-20/Assignments.sol
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
pragma solidity ^0.4.0;

contract Assignments {
function returnFirstValue(uint a, uint b) returns (uint) {
return a;
}

function caller() public returns (uint) {
return returnFirstValue({b:4, a:8});
}

function returnAllValues(uint a, uint b, uint c) returns (uint, uint, uint) {
return (a,b,c);
}

function callerAll() public returns (uint, uint, uint) {
var(x,y,z) = returnAllValues(4,5,6);
(x,y) = (y,x);
(x,) = returnAllValues(5,10,15);
(,z) = returnAllValues(10,20,30);
return (x,y,z);
}
}

0 comments on commit 861715b

Please sign in to comment.