lesson-9 performUpkeep
function
#2406
-
Does not understand how this line how it's written and working?
the entire code is mentioned below.
|
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 12 replies
-
Simple explanation: In this line, we are saying that if Now a slightly detailed explanation, Solidity has this logical operator called |
Beta Was this translation helpful? Give feedback.
Simple explanation: In this line, we are saying that if
upkeepNeeded
is not true, we are reverting function execution withlottery_UpkeepNotNeeded
error.Now a slightly detailed explanation, Solidity has this logical operator called
Logical NOT
written like!
This operator returns true if a condition is not satisfied and if it is satisfied, it returns false. So for example, lets say we have this condition1>2
normally this returns false right? but if we use logical NOT!
in this expression it returns true. So!1>2
is TRUE and the opposite!2>1
is false.So if somethis is true and you put
!
in front it becomes false and if it is false and you put!
it becomes true.Back to your question, w…