In: Economics
What is favorite bool?
Bool is a short form for Boolean in programming language. In Computer Science, bool or boolean is a data type that can hold either true or false value. A boolean value is evaluated by a boolean expression.An equality operator(==) is used to compare the two values. If the two values are equal than it produces an output having a boolean value "True" and if the two values are not equal then it produces an output having a boolean value "false".
for example: print(7 == 7)
print(7== 8)
if you run the above code on Python then the output will be:
True #since 7 is equal to 7
False #since 7 is not equal to 8
(note: # denotes a comment in Python)
Now consider the code in C# below
bool favorite = true; if (favorite) { Console.WriteLine("chocolates"); }
Here boolean is assigned to a variable favorite which holds value True. If the condition is true then it will print "chocolates".
so" favorite" is just a variable that is assigned to booloean.