Explain solidity>parameters

Function Parameters

Functions can accept inputs called parameters. This lets you pass data into the function.

Syntax:

function name(type paramName) public { }

Example:

function setPlayer(address _player) public { }

address - The parameter type

_player - The parameter name (underscore is convention for parameters)



Let's add a parameter to our startGame function so we can specify the opponent.

Change: function startGame(address _opponent) public { }

Add parameter to startGame
33%
Requirements:
Has address parameter
Parameter named _opponent
Still marked as public