We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
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
The text was updated successfully, but these errors were encountered:
As we talked about on IRC, this was an example that helped (I'm using version 0.4dev):
use std; use 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() { let pt: Point = Point {x:4.5, y:5.5}; let circle: Shape = Circle(pt,1.7); area(circle); let pi = float::consts::pi; if area(circle) - 1.7 * 1.7 * pi < 0.1 { io::println("OK"); } }
Sorry, something went wrong.
Closing this; no clear bug being reported.
Merge pull request rust-lang#3483 from chrisduerr/master
7650f0b
Enable overflow_delimited_expr for structs
Auto merge of rust-lang#3483 - RalfJung:drop, r=RalfJung
0f44382
add test for Drop terminator on non-drop type Fixes rust-lang/miri#2737
No branches or pull requests
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
The text was updated successfully, but these errors were encountered: