[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 15:26:23 CET 2023


Yes it is exactly as generated by chat gpt, interesting

"Failure is the key to success; 
 each mistake teaches us something"  .. Morihei Ueshiba
Brian G

----- On Feb 14, 2023, at 2:39 AM, Benoit Minisini benoit.minisini at gambas-basic.org wrote:

> Le 14/02/2023 à 08:24, Brian G a écrit :
>> 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
>> 
>> 
>> ----[ http://gambaswiki.org/wiki/doc/netiquette ]----
> 
> There is something curious in the generated code.
> 
> ChatGPT uses the EXIT keyword instead of the BREAK keyword, which is a
> synonymous.
> 
> But the EXIT keyword is not documented anywhere in the Gambas
> documentation. And as far as I searched with Google, I didn't find it
> either in any page about Gambas.
> 
> So, how could ChatGPT use it if it would be fed by Internet only? Is it
> the same system that produces code and text?
> 
> I am suspicious. As usual. :-)
> 
> --
> Benoît Minisini.
> 
> 
> ----[ http://gambaswiki.org/wiki/doc/netiquette ]----


More information about the User mailing list