Question · Blockchain and Web3 course · Module 6: Solidity Basics

Require vs Assert

What is the main difference between require() and assert() in Solidity?

Answer options

  • require() is for input validation, assert() is for invariants
  • require() is faster
  • assert() returns better errors
  • There's no difference

You can check the correct answer by solving this task in the CodeWorlds game.