## Hl7Message.get() method

> Warning: This API is now obsolete.
>
> Use getSegment() instead. This method will be removed in a future release.

Returns an HL7 segment by index or by name.

**Signature:**

```typescript
get(index: number | string): Hl7Segment | undefined;
```

## Parameters

| Parameter | Type | Description |
| --- | --- | --- |
| index | number \| string | The HL7 segment index or name. |

**Returns:**

[Hl7Segment](/content/docs/sdk/core.hl7segment) \| undefined

The HL7 segment if found; otherwise, undefined.
