1

Here is my code, dailyquotes event has 2 arguments and so does return statement, then why the error?

pragma solidity >0.7.0 < 0.9.0;

// SPDX-License-Identifier: open

contract Letscode{
    struct dailyquote{
        string today;
        uint luckynumber;
    }

    event dailyquotes(uint luckynumber, string today);

    function listinfo() public returns(uint256, string memory) {
        emit dailyquotes(7 , 'love in the air');
        return dailyquotes;

    }

}

1 Answer 1

1

it's complaining that you are trying to return something in the function but the function signature doesn't have returns (<return type>) defined.

Also, you can't return and event.

if you remove the line

return dailyquotes;

the error will go away

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.