SRL Archive - Suggestions

ExitFunction (ResultType : Boolean);


Cstrike

2010-11-07 16:42:56

This is probably the most minor suggestion ever given, but I'll throw it out there anyways.

Is it possible to have an ExitFunction (arg : Boolean);
It would Exit any given function, and set the result to whatever you want in the bracket.

There's tons of times where I have to call
  if condition then
begin
Result := False;
Exit;
end;

or the true version of that.

I don't know if this is possible, and it is really quite minor since it's only cutting down on three lines of code.

Dynamite

2010-11-07 16:45:28

i am in favor

Wizzup?

2010-11-07 16:46:14

Exit(False) works in normal pascal. Does it not work in Simba?

Cstrike

2010-11-07 16:51:08

From: Wizzup?
Exit(False) works in normal pascal. Does it not work in Simba?


I haven't tried that, going to try it right now

EDIT:

Exit(false); doesn't work, I get "Internal error" 20 at that line

program new;

function ResultTest : Boolean;
begin
writeln ('testing');
Exit(false);
wait (1000);
Result := True;
end;

begin
writeln(ResultTest);
end.

i luffs yeww

2010-11-07 16:52:56

I'd have it as ExitFunction(ResultType: Variant); by the way. Not the best practice though. Maybe BoolExit(Return: Boolean); IntExit(Return: Integer); etc. etc.

Also, "Truel" :p

Cstrike

2010-11-07 16:55:32

Also, "Truel" :p


CRAP

Fixed :)

mastaraymond

2010-11-07 16:58:45

Uhm, if it doesn't work it's probably quite hard to implement.