Assignment 7

Published by Mario Oettler on

Follow the following steps:

  1. Write a smart contract that declares a contract variable of type string named greeter. Assign a value to it (e. g. “Hello World!”).
  2. Write a function that has a state mutability of view that returns the value of the variable greeter.
  3. Write another function that is not declared view that returns this value.
  4. Write a function that takes the parameters uint256 _a and uint256 _b and returns the sum of both. What would be the correct state mutability declaration?
  5. Write a function like above without the proper state mutability declaration.
  6. Try your functions out.
Categories:

if()