Código Delphi [-] function foo(const s: string): string; begin if (s[1] = '/')and(s[2] = '/') then Result := 'Hola' else Result := 'Adios'; end;
function foo(const s: string): string; begin if (s[1] = '/')and(s[2] = '/') then Result := 'Hola' else Result := 'Adios'; end;
Código Delphi [-] function foo(const s: string): string; const MSG: array[Boolean] of string = ('Adios','Hola'); begin Result := MSG[(s[1] = '/')and(s[2] = '/')]; end;
function foo(const s: string): string; const MSG: array[Boolean] of string = ('Adios','Hola'); begin Result := MSG[(s[1] = '/')and(s[2] = '/')]; end;
Código Delphi [-] ShowMessage(foo('//ClubDelphi'));
ShowMessage(foo('//ClubDelphi'));