0

This question already has an answer here:

How to write a classical hello world code in solidity? please ignore the below code

contract SimpleStorage { uint storedData; uint x=4; console.log("Your debug message"); }

marked as duplicate by Richard Horrocks, Rob Hitchens - B9lab solidity May 30 at 18:08

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

1

If you want to get started with Solidity, try CryptoZombies (https://cryptozombies.io). It's a funny tutorial that takes you through the first steps of Smart-Contract-Development.

I also recoment the Remix Web-IDE (http://remix.ethereum.org) for your first own contracts. It has a built in syntax-check and compiler.

0

The way to an output a message is by using Events.

Events are inheritable members of contracts. When you call them, they cause the arguments to be stored in the transaction’s log - a special data structure in the blockchain. These logs are associated with the address of the contract, are incorporated into the blockchain, and stay there as long as a block is accessible (forever as of the Frontier and Homestead releases, but this might change with Serenity). The Log and its event data is not accessible from within contracts (not even from the contract that created them).

If you're looking for a basic 'Hello world'-like contract to get started. Try this:

pragma solidity >=0.4.0 <0.6.0;

contract SimpleStorage {
    uint storedData;

    function set(uint x) public {
        storedData = x;
    }

    function get() public view returns (uint) {
        return storedData;
    }
}

This example sets the value of a variable and exposes it for other contracts to access.

Not the answer you're looking for? Browse other questions tagged or ask your own question.