Initial commit
This commit is contained in:
20
test/grammer/function/01.dart
Normal file
20
test/grammer/function/01.dart
Normal file
@@ -0,0 +1,20 @@
|
||||
void main() {
|
||||
double toly = bmi(1.8, 70);
|
||||
double ls = bmi(1.79, 65);
|
||||
double wy = bmi(1.69, 50);
|
||||
|
||||
print("===toly:$toly===ls:$ls===wy:$wy===");
|
||||
}
|
||||
|
||||
// void main() {
|
||||
// double toly = 1.8 / (70 * 70);
|
||||
// double ls = 1.79 / (65 * 65);
|
||||
// double wy = 1.69 / (50 * 50);
|
||||
// print("===toly:$toly===ls:$ls===wy:$wy===");
|
||||
// }
|
||||
|
||||
double bmi(double height, double wight) {
|
||||
// 具体算法
|
||||
double result = wight / (height * height);
|
||||
return result;
|
||||
}
|
||||
23
test/grammer/function/02.dart
Normal file
23
test/grammer/function/02.dart
Normal file
@@ -0,0 +1,23 @@
|
||||
void main() {
|
||||
double toly = bmi(weight: 70, height: 1.8);
|
||||
double ls = bmi(height: 1.79);
|
||||
double wy = bmi(height: 1.69, weight: 50);
|
||||
|
||||
print("===toly:$toly===ls:$ls===wy:$wy===");
|
||||
}
|
||||
|
||||
// void main() {
|
||||
// double toly = 1.8 / (70 * 70);
|
||||
// double ls = 1.79 / (65 * 65);
|
||||
// double wy = 1.69 / (50 * 50);
|
||||
// print("===toly:$toly===ls:$ls===wy:$wy===");
|
||||
// }
|
||||
|
||||
double bmi({
|
||||
required double height,
|
||||
double weight = 65,
|
||||
}) {
|
||||
// 具体算法
|
||||
double result = weight / (height * height);
|
||||
return result;
|
||||
}
|
||||
20
test/grammer/function/03.dart
Normal file
20
test/grammer/function/03.dart
Normal file
@@ -0,0 +1,20 @@
|
||||
void main() {
|
||||
double toly = bmi(70, 1.8);
|
||||
double ls = bmi();
|
||||
double wy = bmi(1.69);
|
||||
|
||||
print("===toly:$toly===ls:$ls===wy:$wy===");
|
||||
}
|
||||
|
||||
// void main() {
|
||||
// double toly = 1.8 / (70 * 70);
|
||||
// double ls = 1.79 / (65 * 65);
|
||||
// double wy = 1.69 / (50 * 50);
|
||||
// print("===toly:$toly===ls:$ls===wy:$wy===");
|
||||
// }
|
||||
|
||||
double bmi([double height = 1.79, double weight = 65]) {
|
||||
// 具体算法
|
||||
double result = weight / (height * height);
|
||||
return result;
|
||||
}
|
||||
Reference in New Issue
Block a user