Skip to content

Commit

Permalink
Add files via upload
Browse files Browse the repository at this point in the history
  • Loading branch information
rohitscript authored Oct 13, 2022
1 parent b432e17 commit fb77267
Showing 1 changed file with 18 additions and 0 deletions.
18 changes: 18 additions & 0 deletions 29Day-TeamPlayers.sol
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
//SPDX-License-Identifier: GPL-3.0

pragma solidity >=0.5.0 <0.9.0;

contract Day5 {
//Create an array(address type) which stores only 16 elements
address[16] team;
//getTeamPlayers() - To return the entire array elements.
function getTeamPlayers() public view returns (address[16] memory) {
return team;
}
//selectJerseyNumber() - It will take only one argument of uint type and returns the players address from the array created above. a) The argument passed into the function must be greater than equal to zero and less than equal to 15.
function selectJerseyNumber(uint256 playerId) public returns (uint256) {
require(playerId >= 0 && playerId <= 15);
team[playerId] = msg.sender;
return playerId;
}
}

0 comments on commit fb77267

Please sign in to comment.