flipper.sol 498 B

1234567891011121314151617181920
  1. contract flipper {
  2. bool private value;
  3. /// Constructor that initializes the `bool` value to the given `init_value`.
  4. constructor(bool initvalue) {
  5. value = initvalue;
  6. }
  7. /// A message that can be called on instantiated contracts.
  8. /// This one flips the value of the stored `bool` from `true`
  9. /// to `false` and vice versa.
  10. function flip() public {
  11. value = !value;
  12. }
  13. /// Simply returns the current value of our `bool`.
  14. function get() public view returns (bool) {
  15. return value;
  16. }
  17. }