[Gambas-user] I asked chat gpt to write a gambas script, here is what it did
brian at westwoodsvcs.com
Tue Feb 14 08:24:24 CET 2023
write a gambas script to print primes from 2 to 300
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
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the User