fmt.sol 1.0 KB

12345678910111213141516171819202122232425262728293031323334353637
  1. contract TernaryExpression {
  2. function test() external {
  3. bool condition;
  4. bool someVeryVeryLongConditionUsedInTheTernaryExpression;
  5. condition ? 0 : 1;
  6. someVeryVeryLongConditionUsedInTheTernaryExpression
  7. ? 1234567890
  8. : 987654321;
  9. condition /* comment1 */ /* comment2 */
  10. ? 1001 /* comment3 */ /* comment4 */
  11. : 2002;
  12. // comment5
  13. someVeryVeryLongConditionUsedInTheTernaryExpression
  14. ? 1
  15. // comment6
  16. // comment7
  17. : 0; // comment8
  18. uint256 amount = msg.value > 0
  19. ? msg.value
  20. : parseAmount(IERC20(asset).balanceOf(msg.sender), msg.data);
  21. uint256 amount = msg.value > 0
  22. ? msg.value
  23. // comment9
  24. : parseAmount(IERC20(asset).balanceOf(msg.sender), msg.data);
  25. uint256 amount = msg.value > 0
  26. // comment10
  27. ? msg.value
  28. : parseAmount(IERC20(asset).balanceOf(msg.sender), msg.data);
  29. }
  30. }