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,050 points
50 views

1 answer to this question.

Your answer

Your name to display (optional):
Privacy: Your email address will only be used for sending these notifications.
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
• 16,450 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,040 points
105 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,330 points
225 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
65 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
• 65,850 points
29 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
• 16,450 points
26 views
+1 vote
7 answers

© 2018 Brain4ce Education Solutions Pvt. Ltd. All rights Reserved.
"PMP®","PMI®", "PMI-ACP®" and "PMBOK®" are registered marks of the Project Management Institute, Inc. MongoDB®, Mongo and the leaf logo are the registered trademarks of MongoDB, Inc.