fmt.sol 1.2 KB

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