Search code examples
ethereumsolidity

Solidity: logical AND outputs parser error


I'm totally new to solidity and programming in general but I stumbled on an issue in my code when trying to use the "and" operator with my if statement:

        if (multiBlockRandomGen(5715713, 10) >= 512) && (y > 1) {
            /*rest of the code*/;
        }

it outputs an "ParserError: Expected primary expression" error on the first "&" character. I've looked everywhere and I'm not sure what the problem is. Thanks.


Solution

  • Its Syntax error logical and operator is outside of if statement. After fixed syntax error you code would be:

        if (multiBlockRandomGen(5715713, 10) >= 512 && y > 1) {
            /*rest of the code*/;
        }
    

    Let me know any issues your facing