0

Below is the simple code written by me

// SPDX-License-Identifier: MIT
pragma solidity ^0.8.16 ;
contract blue
{
   string first ;
uint age ;
 

 function sett ( string memory fn , uint um)  public  returns (string  memory, uint )
 {
     first =  fn ;
     age = um ;
 }

I want that the value passed by me should be showed in remix console. However , when I enter values , txn is successful but values are not shown even though I am returning the values in function using returns. Can anyone please tell me what am I missing. I want that after I enter values and upon pressing Transact button , the values shall display .

enter image description here

Even in the decoded output my inputs are not being shown . What is the mistake being made by me

enter image description here

1 Answer 1

0

actually it is not a view function and since you are changing the state of the block chain in your gett function it cannot be view at all, and if it is not a view function then remix does not prints the values. So just create a get() function aside to get string and uint like this -

    function get () public view returns (string memory, uint) {
        return (first, age);
    }

That is how much I understand remix, I hope this will solve your problem. Thanks.

2
  • 1
    Is there any way to input and display through same function ?
    – Brijesh
    Commented Aug 23, 2022 at 6:16
  • Please refer to solidity official docs for more info, and I don't think so it is possible in remix. Thanks Commented Aug 23, 2022 at 6:29

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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