Koozali.org: home of the SME Server
Contribs.org Forums => General Discussion => Topic started by: ReetP on September 16, 2023, 09:22:45 PM
-
My mate gave me some instructions on how to install and run some local AI/LLM (you do need a bit of grunt to do this)
My first time playing with it!
It is quite interesting but the problem seems to be asking the right question!
If anyone is interested I have a channel on our Rocket.Chat to chat about it. Just ask for an account an I can add you.
-
Messing with WizardCoder 15B :-)
Instruction: write some perl code to show if an integer is 1 or more and default to 0 otherwise
Response: Here's a simple Perl code to check if an integer is greater than or equal to 1 and default to 0 if it's not:
#!/usr/bin/perl
use strict;
use warnings;
sub is_valid_number {
my $number = shift;
return $number >= 1 ? $number : 0;
}
print is_valid_number(5); # Output: 5
print is_valid_number(-3); # Output: 0
print is_valid_number(0); # Output: 0
print is_valid_number(1.5);# Output: 0
In this code, we define a function called `is_valid_number` that takes an integer as its argument. We then check if the number is greater than or equal to 1 using the ternary operator. If it is, we return the number. Otherwise, we return 0.
We then call the `is_valid_number` function with different arguments and print the returned values.