// SPDX-License-Identifier: MIT
pragma solidity ^0.8.9;
contract ConversionDemo {
// Function to demonstrate explicit conversion from uint8 to uint256.
// This is a simple case where a smaller integer (uint8) is being converted
// to a larger integer (uint256), which can be done implicitly.
function ConversionExplicitUINT8toUINT256() pure public returns (uint){
uint8 myVariable = 10; // Declaring a uint8 variable and initializing it to 10.
uint256 someVariable = myVariable; // Implicitly converting uint8 to uint256.
return someVariable; // Returning the converted value.
}
// Function to demonstrate explicit conversion from uint256 to uint8.
// This requires an explicit conversion because uint256 is larger than uint8
// and there could be a loss of data.