pragma solidity ^0.4.24;

contract practice{
int a=10;
function trial() public returns(int){

Functions can either be invoked via transactions or calls. Transactions are used for functions that mutate state, and transactions do not have return values. Calls cannot mutate state but do have return values.

Remix uses a call only when the function has the pure or view modifier. Just add view, and things will work how you expect:

function trial() public view returns (uint) {

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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