fork download
  1. uses Variants;
  2. procedure foo(me: Variant);
  3. begin
  4. case VarType(me) of
  5. varDouble: WriteLn('I am floating cockerel ', me);
  6. varShortInt: WriteLn('Je suis integer ', me);
  7. varString: WriteLn('Soy string ', me);
  8. else
  9. Writeln('Kakoi bagor )))')
  10. end
  11. end;
  12.  
  13. function Kukareku(what: Integer): Variant;
  14. begin
  15. case what of
  16. 0: Kukareku := 42;
  17. 1: Kukareku := 3.14;
  18. 2: Kukareku := 'stroka';
  19. end;
  20. end;
  21.  
  22.  
  23. begin
  24. foo(Kukareku(0));
  25. foo(Kukareku(1));
  26. foo(Kukareku(2));
  27.  
  28. foo(42);
  29. foo(3.14);
  30. foo('stroka')
  31. end.
  32.  
Success #stdin #stdout 0s 4352KB
stdin
Standard input is empty
stdout
Je suis integer 42
I am floating cockerel 3.14
Soy string stroka
Je suis integer 42
I am floating cockerel 3.14
Soy string stroka