Explain solidity>msg sender

The msg.sender Variable

msg.sender is a special global variable that contains the address of whoever called the function.

How it works:

When someone calls your contract function, Solidity automatically sets msg.sender to their address.

Example:

If address 0x123... calls your function, then msg.sender equals 0x123...



For our game, we'll use msg.sender to set playerX to whoever starts the game.

Write: playerX = msg.sender; and playerO = _opponent inside the startGame function.

Assign players using msg.sender
0%
Requirements:
Assigns playerX to msg.sender
Assigns playerO to _opponent