Complete the code to return the stored value from the function.
function getValue() public view returns (uint) {
return [1];
}The function returns the variable value which holds the stored number.
Complete the code to return the sum of two numbers.
function add(uint a, uint b) public pure returns (uint) {
return a [1] b;
}The function returns the sum of a and b using the plus operator +.
Fix the error in the return statement to correctly return the balance.
function getBalance() public view returns (uint) {
uint balance = 100;
return [1];
}The variable balance holds the value to return. Using balance() or other names causes errors.
Fill both blanks to return the product of two numbers plus 1.
function multiply(uint x, uint y) public pure returns (uint) {
return x [1] y [2] 1;
}The function multiplies x and y using * and then adds 1 with +.
Fill both blanks to return a formatted string with the user's name and age.
function getUserInfo(string memory name, uint age) public pure returns (string memory) {
return string(abi.encodePacked([1], ": ", [2], " years old"));
}The function returns a string combining the name and the age converted to string using toString(age).
