SRL Archive - Help and Support

how to create function like that


Laimonas171

2012-10-27 07:57:09

I need to create function at symba like at php. which allows to give some value. etc.
[php]
function name($name, $age)
{
if($age>18)
{
return = "My name is: " . $name . " and I'm older then 18";
}else{
return = "My name is: " . $name . " and I'm to young for porn…";
}
}

name('Laimonas', 23); // returns= My name is: Laimonas and I'm older then 18
[/php]


So what I need

to create function on simba with same working conditions

riwu

2012-10-27 08:06:37

function MakeSentence(Name: string; Age: Integer): String;
begin
Result:= 'My name is: ''' + Name + ''' and I''m ';

if Age > 18 then
Result:= Result + 'older than 18'
else
Result:= Result + 'a porn addict!';
end;

begin
Writeln(MakeSentence('Laimonas171', 1));
end.

Laimonas171

2012-10-27 08:18:29

From: riwu
function MakeSentence(Name: string; Age: Integer): String;
begin
Result:= 'My name is: ''' + Name + ''' and I''m ';

if Age > 18 then
Result:= Result + 'older than 18'
else
Result:= Result + 'a porn addict!';
end;

begin
Writeln(MakeSentence('Laimonas171', 1));
end.

AS always thank you Riwu :D you should get like golden helpers badge. :D