QBJS - Fun Facts!
#6
Fun Fact #2 - Custom types can be returned from functions!

Code: (Select All)
Screen 12

Type Circ
    x As Integer
    y As Integer
    r As Integer
    c As Integer
End Type

Dim i As Integer
Dim c As Circ
Do
    Cls
    For i = 1 To 100
        c = MakeCircle
        Circle (c.x, c.y), c.r, c.c
    Next i
    _Limit 10
Loop

Function MakeCircle
    Dim c As Circ
    c.x = Rnd * 640
    c.y = Rnd * 480
    c.r = Rnd * 100 + 10
    c.c = Rnd * 14 + 1
    MakeCircle = c
End Function

Try it on QBJS
Reply


Messages In This Thread
QBJS - Fun Facts! - by dbox - 04-10-2023, 08:46 PM
RE: QBJS - Fun Facts! - by mnrvovrfc - 04-10-2023, 09:48 PM
RE: QBJS - Fun Facts! - by Sprezzo - 04-10-2023, 10:23 PM
RE: QBJS - Fun Facts! - by mnrvovrfc - 04-11-2023, 06:11 AM
RE: QBJS - Fun Facts! - by dbox - 04-11-2023, 08:55 PM
RE: QBJS - Fun Facts! - by dbox - 04-11-2023, 09:20 PM
RE: QBJS - Fun Facts! - by vince - 04-11-2023, 10:03 PM
RE: QBJS - Fun Facts! - by dbox - 04-13-2023, 11:48 AM
RE: QBJS - Fun Facts! - by mnrvovrfc - 04-14-2023, 03:04 AM
RE: QBJS - Fun Facts! - by CharlieJV - 04-14-2023, 04:00 AM
RE: QBJS - Fun Facts! - by bplus - 04-13-2023, 01:45 PM
RE: QBJS - Fun Facts! - by SMcNeill - 04-14-2023, 11:38 AM
RE: QBJS - Fun Facts! - by dbox - 04-14-2023, 01:31 PM
RE: QBJS - Fun Facts! - by vince - 04-14-2023, 11:55 AM
RE: QBJS - Fun Facts! - by mnrvovrfc - 04-14-2023, 02:53 PM
RE: QBJS - Fun Facts! - by dbox - 04-14-2023, 03:55 PM
RE: QBJS - Fun Facts! - by dbox - 04-21-2023, 02:04 PM



Users browsing this thread: 1 Guest(s)