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,390 points
1,591 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,100 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,350 points
4,219 views
0 votes
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,400 points
4,768 views
0 votes
1 answer

Web3j v3.3.1 : Error while generating compiled solidity smart contracts which returns array of struct

Solidity does not support returning structs in ...READ MORE

answered Jun 19, 2018 in Blockchain by aryya
• 7,450 points
1,394 views
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
1,663 views
0 votes
1 answer

Hyperledger Sawtooth vs Quorum in concurrency and speed Ask

Summary: Both should provide similar reliability of ...READ MORE

answered Sep 26, 2018 in IoT (Internet of Things) by Upasana
• 8,620 points
1,215 views
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
• 69,210 points
1,237 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,100 points
498 views
+1 vote
7 answers
webinar REGISTER FOR FREE WEBINAR X
REGISTER NOW
webinar_success Thank you for registering Join Edureka Meetup community for 100+ Free Webinars each month JOIN MEETUP GROUP