I could not figure out what the expression !(...)
means
Example:
if (!(book %in% books))
stop("Unknown book")
I could not figure out what the expression !(...)
means
Example:
if (!(book %in% books))
stop("Unknown book")
Anything you put inside an if ("Anything") will be converted to true or false. The if body only executes if the result is true.
In your case as there is the character '!' indicates a denial of the IF, ie "No Se"
Your expression means:
If there is NO book in the collection of books do
Stop the execution of the expression and display a message (which in your case will be: "Unknown book")
In short, your function is looking for a book in a list, and if it does not find it returns a message.
It is a binary logic operator. It has the function of negation, knowledge as not
. It denies the return of the underlying term. If the return is verdadeiro
the !
operator will render the expression as falsa
.
The language looks like R.