Replies: 1 comment 1 reply
-
I think he did just to give us an example of what happens. Later, he uses require in the first line of the functions he write. Hope that answers your question, -from another solidity noob :) |
Beta Was this translation helpful? Give feedback.
1 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
At the 03:42:00 mark, when explaining reverts, Patrick says that if the 'require' condition isn't met, it undoes past actions. He gives the example of number = 5 being reverted but still costing gas.
My question is: Why not have the require condition as the first line of the function? Why spend so much gas carrying out all those actions only to revert at the end?
Sorry if it's a totally noob question.
Beta Was this translation helpful? Give feedback.
All reactions