How to print a message in Solidity

0 votes
So, I am writing a smart contract and in that I am checking a condition. What I want is that when the condition fails or passes I want to send different message in each case. I can not find any printing statements in Solidity. How can I implement this?
Dec 12, 2018 in Blockchain by slayer
• 29,350 points
15,278 views

1 answer to this question.

+1 vote

You can use the require function to do this. Pass the message you want to print as the 2nd argument:

require(condition, “message to be displayed”)
answered Dec 12, 2018 by Omkar
• 69,210 points

Related Questions In Blockchain

0 votes
1 answer

How to get all address and send ethers in solidity using a loop?

I found a similar code somewhere: contract  Holders{ uint ...READ MORE

answered Jul 31, 2018 in Blockchain by digger
• 26,740 points
2,541 views
0 votes
1 answer

How to make sure transactions take no fee in a private Ethereum blockchain?

In a private ethereum network you have ...READ MORE

answered Mar 26, 2018 in Blockchain by Christine
• 15,790 points

edited Mar 26, 2018 by Christine 1,354 views
0 votes
1 answer

In a Blockchain, how difficult is it to modify the third to last block?

Technically, it's not difficult at all, all ...READ MORE

answered Apr 20, 2018 in Blockchain by Christine
• 15,790 points
824 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
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
0 votes
1 answer

How to control a malicious user in hyperledger fabric?

Fabric is an implementation of blockchain. Blockchain ...READ MORE

answered Jun 29, 2018 in Blockchain by Omkar
• 69,210 points
832 views
0 votes
1 answer

How to save complex object in the contract in solidity

You can't pass objects when initiating a ...READ MORE

answered Oct 15, 2018 in Blockchain by Omkar
• 69,210 points
3,294 views
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