original.sol 1.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758
  1. contract LiteralExpressions {
  2. function test() external {
  3. // bool literals
  4. true;
  5. false;
  6. /* comment1 */ true /* comment2 */;
  7. // comment3
  8. false; // comment4
  9. // number literals
  10. 1;
  11. 123_000;
  12. 1_2e345_678;
  13. -1;
  14. 2e-10;
  15. // comment5
  16. /* comment6 */ -1 /* comment7 */;
  17. // hex number literals
  18. 0x00;
  19. 0x123_456;
  20. 0x2eff_abde;
  21. // rational number literals
  22. .1;
  23. 1.3;
  24. 2.5e1;
  25. // string literals
  26. "";
  27. "foobar";
  28. "foo" // comment8
  29. " bar";
  30. // comment9
  31. "\
  32. some words" /* comment10 */;
  33. unicode"Hello 😃";
  34. // quoted strings
  35. 'hello "world"';
  36. "hello 'world'";
  37. 'hello \'world\'';
  38. "hello \"world\"";
  39. 'hello \"world\"';
  40. "hello \'world\'";
  41. // hex literals
  42. hex"001122FF";
  43. hex'0011_22_FF';
  44. hex"00112233" hex"44556677";
  45. // address literals
  46. 0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2;
  47. // non checksummed address
  48. 0xc02aaa39b223Fe8D0A0e5C4F27ead9083c756Cc2;
  49. }
  50. }