100 Days Of Solidity, Reading State Variables, Writing State Variables, State Variables.
variable will be updated accordingly. It’s important to note that writing to a state variable requires sending a transaction, which typically incurs a small fee referred to as a transaction fee or gas fee. Reading from a State Variable Unlike writing to a state variable, reading its value is free