Skip to content

Commit 6dfe8b8

Browse files
committed
examples: Update wiki code snippets
1 parent 14aec1b commit 6dfe8b8

File tree

8 files changed

+73
-5
lines changed

8 files changed

+73
-5
lines changed
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
'' examples/manual/casting/boolean.bas
2+
''
3+
'' NOTICE: This file is part of the FreeBASIC Compiler package and can't
4+
'' be included in other distributions without authorization.
5+
''
6+
'' See Also: http://www.freebasic.net/wiki/wikka.php?wakka=KeyPgCbool
7+
'' --------
8+
9+
' Using the CBOOL function to convert a numeric value
10+
11+
'Create an BOOLEAN variable
12+
Dim b As BOOLEAN
13+
14+
'Convert a numeric value
15+
b = CBOOL(1)
16+
17+
'Print the result, should return True
18+
Print b
19+
Sleep
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
'' examples/manual/datatype/boolean-false.bas
2+
''
3+
'' NOTICE: This file is part of the FreeBASIC Compiler package and can't
4+
'' be included in other distributions without authorization.
5+
''
6+
'' See Also: http://www.freebasic.net/wiki/wikka.php?wakka=KeyPgFalse
7+
'' --------
8+
9+
Dim b As Boolean = False
10+
If b Then
11+
Print "b is True"
12+
Else
13+
Print "b is False"
14+
End If
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
'' examples/manual/datatype/boolean-true.bas
2+
''
3+
'' NOTICE: This file is part of the FreeBASIC Compiler package and can't
4+
'' be included in other distributions without authorization.
5+
''
6+
'' See Also: http://www.freebasic.net/wiki/wikka.php?wakka=KeyPgTrue
7+
'' --------
8+
9+
Dim b As Boolean = True
10+
If b Then
11+
Print "b is True"
12+
Else
13+
Print "b is False"
14+
End If
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
'' examples/manual/datatype/boolean.bas
2+
''
3+
'' NOTICE: This file is part of the FreeBASIC Compiler package and can't
4+
'' be included in other distributions without authorization.
5+
''
6+
'' See Also: http://www.freebasic.net/wiki/wikka.php?wakka=KeyPgBoolean
7+
'' --------
8+
9+
Dim boolvar As Boolean
10+
boolvar = True
11+
Print "boolvar = ", boolvar

examples/manual/gfx/imageinfo.bas

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ End If
2222

2323
'' Draw a pattern on the image by directly manipulating pixel memory.
2424
For y As Integer = 0 To 63
25-
Dim row As UInteger Ptr = pixels + y * pitch
25+
Dim row As ulong Ptr = pixels + y * pitch
2626

2727
For x As Integer = 0 To 63
2828
row[x] = RGB(x * 4, y * 4, (x Xor y) * 4)

examples/manual/gfx/screenptr2.bas

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -35,16 +35,16 @@ ScreenLock()
3535
For y As Integer = 0 To h - 1
3636

3737
'' Set pixel address to the start of the row
38-
'' It's a 32-bit pixel, so use a UInteger Ptr
39-
Dim As UInteger Ptr pixel = row
38+
'' It's a 32-bit pixel, so use a ULong Ptr
39+
Dim As ULong Ptr pixel = row
4040

4141
For x As Integer = 0 To w - 1
4242

4343
'' Set the pixel value
4444
*pixel = RGB(x, x Xor y, y)
4545

4646
'' Get the next pixel address
47-
'' (UInteger Ptr will increment by 4 bytes)
47+
'' (ULong Ptr will increment by 4 bytes)
4848
pixel += 1
4949

5050
Next x

examples/manual/operator/not-equal2.bas

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,5 +6,5 @@
66
'' See Also: http://www.freebasic.net/wiki/wikka.php?wakka=KeyPgOpNotEqual
77
'' --------
88

9-
If (69 <> 420) Then Print "(420 <> 420) is true."
9+
If (69 <> 420) Then Print "(69 <> 420) is true."
1010
If Not (69 = 420) Then Print "not (69 = 420) is true."
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
'' examples/manual/proguide/literals/boolean.bas
2+
''
3+
'' NOTICE: This file is part of the FreeBASIC Compiler package and can't
4+
'' be included in other distributions without authorization.
5+
''
6+
'' See Also: http://www.freebasic.net/wiki/wikka.php?wakka=ProPgLiterals
7+
'' --------
8+
9+
Dim a As Boolean = False
10+
Dim b As Boolean = True

0 commit comments

Comments
 (0)