S
SHINDO Motoaki
Hi>Volks
This is my 1st post to this ML,
but=E2=80=A6
I read 'bout a problem: (false || not(true))
in a place, and made a little considerations.
I give NOW, the source code AsIs,
with the 'comments' in it=E2=80=A6
=EF=BC=9D=EF=BC=9D=EF=BC=9D=EF=BC=9D=EF=BC=9D
#!/usr/bin/env ruby -Ku
def case1(c)
if c.nil?
# does nothing
elsif !c # c =3D=3D false || not true
# does nothing
else
puts "case1: ", c
end
# It's just NO problem, in C-programmer fashion [not fully tested]
end
def case2(c)
if c.nil?
# does nothing
# c =3D=3D false || not true if you want it to be TRUE, before that,
#elsif c.class =3D=3D Boolean or
#elsif c.class !=3D Char or something, you must ask.
# 1st of all, have WE Classes like Boolean or Char ???
elsif c.class !=3D String # now this line may be =
wrong question=E2=80=A6
# does nothing
puts "case2: c is no String"
elsif !c
puts "case2: ", c
end
end
c =3D STDIN.getc()
case1(c)
case2(c)
# Was it just Me? that
# got troubled with needless TRUE
# in evaluating True-False, aString(or aChar) AsIs=E2=80=A6
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
2 bits thinking helps 66.7%
Shindo Motoaki (Motoakira)
21, Higashi-Kurayoshi machi
Yonago City, Tottori Pref.
683-0815, Japan
TEL 81-859-33-7431/81-90-7593-3585
<[email protected]>
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
This is my 1st post to this ML,
but=E2=80=A6
I read 'bout a problem: (false || not(true))
in a place, and made a little considerations.
I give NOW, the source code AsIs,
with the 'comments' in it=E2=80=A6
=EF=BC=9D=EF=BC=9D=EF=BC=9D=EF=BC=9D=EF=BC=9D
#!/usr/bin/env ruby -Ku
def case1(c)
if c.nil?
# does nothing
elsif !c # c =3D=3D false || not true
# does nothing
else
puts "case1: ", c
end
# It's just NO problem, in C-programmer fashion [not fully tested]
end
def case2(c)
if c.nil?
# does nothing
# c =3D=3D false || not true if you want it to be TRUE, before that,
#elsif c.class =3D=3D Boolean or
#elsif c.class !=3D Char or something, you must ask.
# 1st of all, have WE Classes like Boolean or Char ???
elsif c.class !=3D String # now this line may be =
wrong question=E2=80=A6
# does nothing
puts "case2: c is no String"
elsif !c
puts "case2: ", c
end
end
c =3D STDIN.getc()
case1(c)
case2(c)
# Was it just Me? that
# got troubled with needless TRUE
# in evaluating True-False, aString(or aChar) AsIs=E2=80=A6
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
2 bits thinking helps 66.7%
Shindo Motoaki (Motoakira)
21, Higashi-Kurayoshi machi
Yonago City, Tottori Pref.
683-0815, Japan
TEL 81-859-33-7431/81-90-7593-3585
<[email protected]>
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D