Skip to content

Instantly share code, notes, and snippets.

@expalmer
Created August 16, 2014 19:26
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save expalmer/5f1693761a94c215cb23 to your computer and use it in GitHub Desktop.
Save expalmer/5f1693761a94c215cb23 to your computer and use it in GitHub Desktop.
Vazio é true ou false ? by @wbruno
# PHP
$ php -r "var_dump( (boolean)'') .PHP_EOL;"
bool(false)
# NodeJs
$ node
> !!""
false
# ShellScript
$ vim boolean.sh
if [ "" = true ] ; then
echo 'true'
else
echo 'false'
fi
:wq!
$ sh boolean.sh
false
# Ruby
$ irb
> !!""
(irb):1: warning: string literal in condition
=> true
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment