Bool
struct Bool
-
Creates a boolean from
PerlScalar
using Perl macrosSvTRUE
.False in Perl is any value that would look like
""
or"0"
if evaluated in a string context. Since undefined values evaluate to""
, all undefined values are false, but not all false values are undefined.let b = Bool(PerlScalar()) // b == false let b = Bool(PerlScalar(0)) // b == false let b = Bool(PerlScalar("")) // b == false let b = Bool(PerlScalar("0")) // b == false let b = Bool(PerlScalar(1)) // b == true let b = Bool(PerlScalar(100)) // b == true let b = Bool(PerlScalar("100")) // b == true let b = Bool(PerlScalar("000")) // b == true let b = Bool(PerlScalar("any")) // b == true let b = Bool(PerlScalar("false")) // b == true
Declaration
Swift
public init(_ scalar: PerlScalar)