fork download
  1. calculateArea(dynamic shape, int width, int height, double radius) {
  2. shape == 'Circle'
  3. ? print(3.14 * radius * radius)
  4. : shape == 'Rectangle'
  5. ? print(width * height)
  6. : print('error shape tyype');
  7. }
  8.  
  9. void main() {
  10. String shapeC = 'Circle';
  11. String shapeR = 'Rectangle';
  12. calculateArea(shapeR, 4, 5, 0);
  13. }
  14.  
Success #stdin #stdout 1.63s 127856KB
stdin
Standard input is empty
stdout
20