Closed

Description
import io::*;
struct Point {x:float, y:float}
enum Shape{
Circle(Point, float),
Rectangle(Point, Point)
}
fn area(sh: Shape)->float{
match sh{
Circle(_,size)=>float::consts::pi*size*size,
Rectangle(point1, point2)=>(point2.x-point1.x)*(point2.y-point1.y)
}
}
fn main(){
Circle{(4.5,5.5,),1.0};
area(circle);
}
it doesn't work.. I'm a person who is using english as second language..
So there's a problem to understand document..
Please Let me know how to use it properly
Metadata
Metadata
Assignees
Labels
No labels