Lesson 2: Assignments & Exercises

Assignments and Practical Exercises

Assignment 1:

  • Research and write a brief explanation of how gas costs are affected by data types and control structures in Solidity. Focus on why it's important to choose appropriate data types and control structures.

Exercise 1:

  • Create a Solidity contract that demonstrates the use of different data types. Include at least one example of each: uint, int, bool, address, and bytes.

Exercise 2:

  • Write a smart contract that includes:

    • A conditional statement (if/else).

    • A loop (your choice of for, while, or do while).

    • Comment on each section explaining what it does.

Last updated