I'm starting learning Solidity. I'm using Visual Studio Code with Remix IDE extension.
I already have a little problem 😅
I wrote this simple contract :
// SPDX-License-Identifier: UNLICENSED
pragma solidity 0.8.12;
contract test2 {
bool myBool;
function getBool() public view returns(bool){
return myBool;
}
function setBool(bool _bool) public {
myBool = _bool;
}
I compiled it and deploy it in testnet Blockchain.
After using getBool()
, i get a false. Nothing to report here...
Then I set the value true to myBool
with setBool()
. I get a true after using getBool()
. Everything is okay here.
But, when i want to set false to myBool
with setBool()
, I still obtain a true with getBool()
. I don't understand how and why?
Thank you for your help. (Sorry for my english if i made some mistakes)
I have not enough reputation to just comment so it will be an anwer. Your code is correct but there are may be some tricky issues.