Udacity asked the question: done is a boolean value. What is the value of !!done? here is the answer.

by 5:58 AM 0 comments

Booleans: where everything seems to have started.


This goes back to boolean algebra, If you say

true = true   
false = false
then

not true = false
not false = true
so that means

not (not true)  = not false = true 
not (not false) = not true  = false
which means !!done = done

you can write "not" as "!"

!true  = false
!false = true
which means

!!true  = !false = true
!!false = !true = false
so if done is a boolean: true or false, when its put in !!done it will always be done. for example:

boolean done = true;
!!done this will always be its initial value which is true


Unknown

Android Developer at Appsix LLC

I love stickers and reading books. A cool website that I've found was commitstrip.com
Currently reading: The pragmatic programmer, and The C programming language.
Currently working: an android app, and on a web project with laravel.
Im a 9gag enthusiast.
I write code at work and at home for fun or out of pure boredom.
Programming Languages that I've worked with: Java PHP C# PLSQL JavaScript
Thanks for reading.



0 comments :

Post a Comment