1: price_by_age({car,Age}) -> 10 * (10 - Age);
2: price_by_age({boat,Age}) -> 20 * (20 - Age).
is equivalent to
1: price_by_age(Vehicle) ->
2: case Vehicle of
3: {car,Age} -> 10 * (10 - Age);
4: {boat,Age} -> 20 * (20 - Age)
5: end.
No comments:
Post a Comment