Method Returns String of Boolean - Why Dont You Need to Include "= True" or "= False" ?
- From: "icon128x128" <icon128x128@xxxxxxxxx>
- Date: Tue, 30 Aug 2005 10:38:16 -0400
>From a article at Realbasic Univeristy: Column 35 the following method was
obtained:
Function bStr(b as boolean) As string
If b then
return "true"
else
return "false"
end if
End Function
So MsgBox bStr(false) would produce "False" in a message box. What the
code appears to be really saying is:
Function bStr(b as boolean) As string
If b = true then
return "true"
else if b = false then
return "false"
end if
End Function
My question is why do you have to include the part "= true". I understand
why you do not have to include "= false" because its taken care of by the
previous lines; however, I do not udnerstand why in the first example you
are allowed to skip including the "=" part at all. how does RB know you
are talking about true in the first line if you do include it? I
understand booleans are false by default, but I don't get this.
.
- Follow-Ups:
- Prev by Date: Can't get sockets working
- Next by Date: Re: Method Returns String of Boolean - Why Dont You Need to Include "= True" or "= False" ?
- Previous by thread: Can't get sockets working
- Next by thread: Re: Method Returns String of Boolean - Why Dont You Need to Include "= True" or "= False" ?
- Index(es):
Relevant Pages
|