Solidity: logical AND outputs parser error

0 votes

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.

Oct 12, 2018 in Blockchain by sabby
• 4,350 points
84 views

1 answer to this question.

0 votes

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

answered Oct 12, 2018 by Perry
• 17,020 points

Related Questions In Blockchain

0 votes
1 answer

Invalid opcode error in a simple Solidity contract and script

You don't need to call .at() if you're using .new(). ...READ MORE

answered Sep 14, 2018 in Blockchain by slayer
• 29,050 points
167 views
+1 vote
1 answer

What is the difference between if() and require() statement in solidity??

If() and require() have separate functions and ...READ MORE

answered Apr 18, 2018 in Blockchain by Shashank
• 10,350 points
371 views
0 votes
1 answer
0 votes
1 answer

Truffle tests not running after truffle init

This was a bug. They've fixed it. ...READ MORE

answered Sep 11, 2018 in Blockchain by Christine
• 15,790 points
138 views
0 votes
1 answer
0 votes
1 answer

Solidity geth: Error encountered during contract execution [Bad instruction]

recipes is a dynamic storage array. You need ...READ MORE

answered Oct 15, 2018 in Blockchain by Omkar
• 67,380 points
75 views
+1 vote
2 answers

Is there any relation between the number of transactions processes and the miners?

the direct answer to your query is ...READ MORE

answered Jun 19, 2018 in Blockchain by Perry
• 17,020 points
39 views
+1 vote
7 answers