How to print the value of variable using truffle console

pragma solidity ^0.5.1;
contract PRetVal {
   uint8  iVar =0;
   function testFunc() public returns (uint8) { 
      iVar = iVar + 10;
      return iVar;
   }
}

I am trying the following :

truffle(development)> PR = await PRetVal.at(0x596D30c26211B4Dab998F63D6Bf5eba55B0B1d2D) 
undefined
truffle(development)> await PR.getIVar 

Truffle has built-in ‘get” functions. But I am not getting any value. Somebody please guide me.

Zulfi.

:computer: Environment

:memo:Details

:1234: Code to reproduce

1 Like

I think you can have a try like this:

truffle(development)> await PR.getIVar()
1 Like