6

I've noticed that some emoji and special characters are supported as variable names in Delphi such as

var
  ❤ : string;
  ⅖ : double;
begin
  ❤ := 'My heart';
  ShowMessage(❤);
  ⅖ := 0.4;
  ShowMessage(⅖.ToString);
end;

Does anyone know a complete list of interesting characters that can be used? It's possible to bring up emoji characters in Win10 via Win+[.] (The windows key plus dot).

OneCricketeer
  • 179,855
  • 19
  • 132
  • 245
Alister
  • 6,527
  • 4
  • 46
  • 70
  • 3
    Per [Fundamental Syntactic Elements: Identifiers](http://docwiki.embarcadero.com/RADStudio/en/Fundamental_Syntactic_Elements_(Delphi)#Identifiers) in the Delphi documentation: "*An identifier can be of any length, but only the first 255 characters are significant. An identifier must begin with an alphabetic character, **a Unicode character**, or an underscore (_) and cannot contain spaces. Alphanumeric characters, **Unicode characters**, digits, and underscores are allowed after the first character.*" I think the only limit is a Unicode character cannot be surrogated (must be U+0000..U+FFFF). – Remy Lebeau Jun 02 '20 at 02:20
  • Cheers @RemyLebeau, this does indeed seem to be the case - I don't think I'll ever need to use a variable name with more than one character ever again :-) – Alister Jun 02 '20 at 03:36
  • Combine it with expanded Unicode aware FORTRAN 77 style implicit variable types based on this first character of a variable name and your code could be nice and compact :) `⅖;` instead of `⅖ : double;` – Brian Jun 02 '20 at 12:50

1 Answers1

3

It's not a complete list, but here are some that work. I have them all listed as inline variables:

  var ❤ := 'Heart';
  var ✌ := 'Peace';
  var ☝ := 'Up finger';
  var ✈ := 'Airplane';
  var ☕ := 'Hot Beverage';
  var ⅛ := 0.125;
  var ¼ := 0.25;
  var ⅓ := 0.33333333333;
  var ⅜ := 0.375;
  var ½ := 0.5;
  var ⅝ := 0.625;
  var ⅔ := 0.66666666667;
  var ⅞ := 0.875;
  var 卌 := 5;
  var ✔ := 'Checkmark';
  var ☁ := 'Cloud';
  var ♣ := 'Club';
  var © := 'Copyright';
  var † := 'Cross';
  var Δ := 'Delta Triangle';
  var ▲ := 'Triangle Dark';
  var ♦ := 'Diamond';
  var ☆ := 'Star';
  var ★ := 'Star Dark';
  var △ := 'Triangle';
  var ✉ := 'Envelope';
  var ✿ := 'Flower';
  var ☭ := 'Hammer and Sickle';
  var ∞ := 'Infinity';
  var λ := 'Lambda';
  var ♫ := 'Note';
  var ☢ := 'Nuclear';
  var π := 'PI';
  var ♯ := 'Sharp';
  var Σ := 'Sigma';
  var ∑ := 'Sum';
  var ☠ := 'Skull';
  var ツ := 'Smile';
  var ☺︎ := 'Smile';
  var ☃ := 'Snowman';
  var ⸫ := 'So';
  var √ := 'Sqrt';
  var ☀ := 'Sun';
  var ↑ := 'Up Arrow';
  var ☯ := 'YinYang';

And some other interesting variable names:

  var ƸӜƷ := 'butterfly';
  var •͡˘㇁•͡˘ := 'eyes';
  var ʕ·͡ᴥ·ʔ := 'bear or koala';
  var ʕっ•ᴥ•ʔっ := 'bear hug';
  var °ʖ° := 'eyes and nose';
  var °ᴥ° := 'eyes and nose';
  var ✜︵✜ := 'eyes and mouth';
  var ╥﹏╥ := 'cry face';
  var 。◕‿‿◕。 := 'cute face';
  var ⌐■_■ := 'glasses';
  var ︶︹︶ := 'depressed';
  var ☉‿⚆ := 'derp';
  var ヽ༼ຈل͜ຈ༽ノ := 'weird face';
  var вєωαяє_ι_αм_ƒαη¢у := 'BEWARE, I AM FANCY';
  var ✌•‿•✌ := 'Peace';
Shaun Roselt
  • 1,650
  • 5
  • 18
  • 44