New echo example.
"Database" example.
EDIT: Pseudo Object-Oriented example:
// ...
main:args {
var polygons = {
[newTriangle pointA:{0, 0} pointB:{5, 0} pointC:{0, 5}],
[newTriangle pointA:{0, 0} pointB:{2, 0} pointC:{0, 2}],
[newCircle centre:{0, 0} radius:10.0],
[newTriangle pointA:{0, 0} pointB:{3, 0} pointC:{0, 4}],
[newCircle centre:{2, 2} radius:5.0],
[newSquare pointA:{0, 0} pointB:{2, 0} pointC:{2, 2} pointD:{0, 2}]
};
foreach(p in polygons) {
[print string:"Perimeter: %v\n" format:{[polygonPerimeter polygon:p]}];
[print string:"Area: %v\n\n" format:{[polygonArea polygon:p]}];
}
}
main:args {
var polygons = {
[newTriangle pointA:{0, 0} pointB:{5, 0} pointC:{0, 5}],
[newTriangle pointA:{0, 0} pointB:{2, 0} pointC:{0, 2}],
[newCircle centre:{0, 0} radius:10.0],
[newTriangle pointA:{0, 0} pointB:{3, 0} pointC:{0, 4}],
[newCircle centre:{2, 2} radius:5.0],
[newSquare pointA:{0, 0} pointB:{2, 0} pointC:{2, 2} pointD:{0, 2}]
};
foreach(p in polygons) {
[print string:"Perimeter: %v\n" format:{[polygonPerimeter polygon:p]}];
[print string:"Area: %v\n\n" format:{[polygonArea polygon:p]}];
}
}
Download complete example!
No comments:
Post a Comment