2024-03-13 14:22:22 -07:00
|
|
|
---
|
2025-05-07 10:33:23 +12:00
|
|
|
title: "legLen"
|
|
|
|
subtitle: "Function in std::math"
|
2024-08-06 20:27:26 -04:00
|
|
|
excerpt: "Compute the length of the given leg."
|
2024-03-13 14:22:22 -07:00
|
|
|
layout: manual
|
|
|
|
---
|
|
|
|
|
2024-08-06 20:27:26 -04:00
|
|
|
Compute the length of the given leg.
|
2024-03-13 14:22:22 -07:00
|
|
|
|
2025-05-01 04:03:22 +12:00
|
|
|
```kcl
|
2025-02-27 22:03:37 +13:00
|
|
|
legLen(
|
2025-05-02 16:00:27 +12:00
|
|
|
hypotenuse: number,
|
|
|
|
leg: number,
|
|
|
|
): number
|
2024-03-13 14:22:22 -07:00
|
|
|
```
|
|
|
|
|
2025-05-07 10:33:23 +12:00
|
|
|
|
|
|
|
|
2024-03-13 14:22:22 -07:00
|
|
|
### Arguments
|
|
|
|
|
2024-09-27 07:37:46 -07:00
|
|
|
| Name | Type | Description | Required |
|
|
|
|
|----------|------|-------------|----------|
|
2025-05-06 11:02:55 +12:00
|
|
|
| `hypotenuse` | [`number`](/docs/kcl-std/types/std-types-number) | The length of the triangle's hypotenuse | Yes |
|
|
|
|
| `leg` | [`number`](/docs/kcl-std/types/std-types-number) | The length of one of the triangle's legs (i.e. non-hypotenuse side) | Yes |
|
2024-03-13 14:22:22 -07:00
|
|
|
|
|
|
|
### Returns
|
|
|
|
|
2025-05-06 16:09:59 +12:00
|
|
|
[`number`](/docs/kcl-std/types/std-types-number) - A number
|
2024-09-27 07:37:46 -07:00
|
|
|
|
2024-03-13 14:22:22 -07:00
|
|
|
|
2024-09-27 07:37:46 -07:00
|
|
|
### Examples
|
|
|
|
|
2025-05-01 04:03:22 +12:00
|
|
|
```kcl
|
2025-04-24 09:53:19 -05:00
|
|
|
legLen(hypotenuse = 5, leg = 3)
|
2024-09-27 07:37:46 -07:00
|
|
|
```
|
2024-03-13 14:22:22 -07:00
|
|
|
|
|
|
|
|
2025-05-06 14:14:11 +12:00
|
|
|
|