Kembali ke Perpustakaan
Region:
Switch to EN
Pemula Exercism • ruby
Booleans
Ringkasan Pelajaran
# Introduction
About
True, False
trueandfalseare used to represent boolean logical states.- They are singleton instances of the
TrueClassandFalseClassobjects. - they may occur as literals in code, or as the result of logical (
&&,||,!) or comparison (<,>,==) methods.
- They are singleton instances of the
Truthy and falsey
-
When not using strict Boolean values, truthy and falsey evaluation rules are applied:
- Only
falseandnilevaluates as falsey. - Everything else evaluates as truthy.
# A simplified definition def falsey nil || false end def truthy not falsey end - Only
Originally from Exercism ruby concepts