Solution: Create a Contract with Attributes and Functions

Let's review the solution to this challenge.

Flowchart of a possible solution

In this challenge, you needed to create a contract named Challenge. This contract has a private variable called targetAmount. It also has a constructor, which has a parameter named amount and checks if the targetAmount is equal to the amount. If true, the program should end; if not, it should display Error.

You also needed to create a corresponding run script to deploy the contract.

Get hands-on with 1200+ tech skills courses.