Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
doc: wiki snapshot
- Loading branch information
Showing
61 changed files
with
348 additions
and
108 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
{{fbdoc item="title" value="BOOLEAN"}}---- | ||
Standard data type | ||
|
||
{{fbdoc item="syntax"}}## | ||
[[KeyPgDim dim]] //variable// [[KeyPgAs as]] **Boolean** | ||
## | ||
{{fbdoc item="desc"}} | ||
Boolean data type. Can hold the values ##[[KeyPgTrue True]]## or ##[[KeyPgFalse False]]##. | ||
|
||
**Notes on definition of boolean data type:** //Ideally, the definition of the boolean data type is that it holds the value of ##[[KeyPgTrue True]]## or ##[[KeyPgFalse False]]##, and that's it. However, to make this concept a reality, we need a definition that uses real world connections. A more realistic definition is that the boolean data type is a 1-bit integer, having the value 0 to indicate ##[[KeyPgFalse False]]## and 1 to indicate ##[[KeyPgTrue True]]##. For a practical definition, we must consider, yet again, additional factors. The most significant factor is that the hardware (processor) on which code is executed does not directly support a 1-bit data type; the smallest register or memory size we can work with is 8-bits or 1-byte. Therefore, a practical definition of boolean data type is an integer, 8 bits wide, having the value 0 or 1, where all other values are undefined. However, because of longstanding differences between C/C""++"" and FB with respect to logical operations, the interpretation of the value must also be considered. Assume "false" is 0 in both C/C""++"" and FB. C/C""++"" has logical 'not' operator '!' such that '!0' produces '1'. FB has a bitwise ##[[KeyPgOpNot Not]]## operator such that 'not 0' produces '-1'. Therefore the definition for a C/C""++"" boolean is an unsigned 1-bit integer, zero extended to fill larger integer types, and the definition for a FB boolean is a signed 1-bit integer, sign extended to fill larger integer types. However, the purpose and intent of the boolean data type remains, that it should only ever hold a ##[[KeyPgTrue True]]## value or ##[[KeyPgFalse False]]## value, regardless of the underlying details.// | ||
|
||
{{fbdoc item="ex"}} | ||
{{fbdoc item="filename" value="examples/manual/datatype/boolean.bas"}}%%(freebasic) | ||
Dim boolvar As Boolean | ||
boolvar = True | ||
Print "boolvar = ", boolvar | ||
%% | ||
**Output:** | ||
%%boolvar = true%% | ||
|
||
{{fbdoc item="lang"}} | ||
- Not available in the //[[CompilerOptlang -lang qb]]// dialect unless referenced with the alias ##**""__Boolean""**##. | ||
|
||
{{fbdoc item="diff"}} | ||
- New to ""FreeBASIC"" | ||
|
||
{{fbdoc item="see"}} | ||
- ##[[KeyPgTrue True]]## | ||
- ##[[KeyPgFalse False]]## | ||
|
||
{{fbdoc item="back" value="CatPgStdDataTypes|Standard Data Types"}} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,69 @@ | ||
{{fbdoc item="title" value="CBOOL"}}---- | ||
Converts numeric or string expression to a boolean (##[[KeyPgBoolean Boolean]]##) | ||
|
||
{{fbdoc item="syntax"}}## | ||
[[KeyPgDeclare declare]] [[KeyPgFunction function]] **Cbool** ( [[KeyPgByval byval]] //expression// [[KeyPgAs as]] [[DataType datatype]] ) [[KeyPgAs as]] [[KeyPgBoolean boolean]] | ||
|
||
[[KeyPgType Type]] //typename// | ||
[[KeyPgDeclare declare]] [[KeyPgOperator operator]] [[KeyPgCast cast]] ( ) [[KeyPgAs as]] [[KeyPgBoolean boolean]] | ||
End Type | ||
## | ||
{{fbdoc item="usage"}}## | ||
//result// = **Cbool**( //numeric expression// ) | ||
//result// = **Cbool**( //string expression// ) | ||
//result// = **Cbool**( //user defined type// ) | ||
## | ||
{{fbdoc item="param"}} | ||
##//expression//## | ||
a numeric, string, or user defined type to cast to a ##[[KeyPgBoolean Boolean]]## value | ||
##//datatype//## | ||
any numeric, string, or user defined type | ||
##//typename//## | ||
a user defined type | ||
|
||
{{fbdoc item="ret"}} | ||
A ##[[KeyPgBoolean Boolean]]## value. | ||
|
||
{{fbdoc item="desc"}} | ||
The ##**Cbool**## function converts a zero value to ##[[KeyPgFalse False]]## and a non-zero value to ##[[KeyPgTrue True]]##. | ||
|
||
The name can be explained as 'Convert to Boolean'. | ||
|
||
If the argument is a string expression, it is converted to boolean using a case insensitive to the string "false" to return a ##[[KeyPgFalse False]]## value or "true" to return a ##[[KeyPgTrue True]]## value. | ||
|
||
{{fbdoc item="ex"}} | ||
{{fbdoc item="filename" value="examples/manual/casting/boolean.bas"}}%%(freebasic) | ||
' Using the CBOOL function to convert a numeric value | ||
|
||
'Create an BOOLEAN variable | ||
DIM b AS BOOLEAN | ||
|
||
'Convert a numeric value | ||
b = CBOOL(1) | ||
|
||
'Print the result, should return True | ||
PRINT b | ||
SLEEP | ||
%% | ||
|
||
{{fbdoc item="lang"}} | ||
- Not available in the //[[CompilerOptlang -lang qb]]// dialect unless referenced with the alias ##**""__Cbool""**##. | ||
|
||
{{fbdoc item="diff"}} | ||
- New to ""FreeBASIC"" | ||
|
||
{{fbdoc item="see"}} | ||
- ##[[KeyPgCbyte Cbyte]]## | ||
- ##[[KeyPgCubyte Cubyte]]## | ||
- ##[[KeyPgCshort Cshort]]## | ||
- ##[[KeyPgCushort Cushort]]## | ||
- ##[[KeyPgCint Cint]]## | ||
- ##[[KeyPgCuint Cuint]]## | ||
- ##[[KeyPgClng Clng]]## | ||
- ##[[KeyPgCulng Culng]]## | ||
- ##[[KeyPgClngint Clngint]]## | ||
- ##[[KeyPgCulngint Culngint]]## | ||
- ##[[KeyPgCsng Csng]]## | ||
- ##[[KeyPgCdbl Cdbl]]## | ||
|
||
{{fbdoc item="back" value="CatPgCasting|Converting Data Types"}} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.