[Gambas-user] I asked chat gpt to write a gambas script, here is what it did
Brian G
brian at westwoodsvcs.com
Tue Feb 14 08:24:24 CET 2023
I asked
write a gambas script to print primes from 2 to 300
then added
please also print the number of primes found
here is the script it produced
Public Sub Main() Dim primes As New Integer[] For i As Integer = 2 To 300 Dim isPrime As Boolean = True For j As Integer = 2 To i - 1 If i Mod j = 0 Then isPrime = False Exit Endif Next If isPrime Then primes.Add(i) Endif Next Print "Prime numbers between 2 and 300:" For Each prime As Integer In primes Print prime Next Print "Total number of primes found: " & primes.Count End
Not elegant but it worked just fine. Ok do we really have a future here!
spoiler, anything more complex was junk, but still....
"Failure is the key to success;
each mistake teaches us something" .. Morihei Ueshiba
Brian G
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.gambas-basic.org/pipermail/user/attachments/20230213/087bb712/attachment-0001.htm>
More information about the User
mailing list