---
title: scalar
framework: coreml
role: symbol
role_heading: Instance Property
path: coreml/mlshapedarrayprotocol/scalar-swift.property
---

# scalar

A computed property that returns the first element when the shape isn’t empty, or sets the shaped array’s underlying scalar type.

## Declaration

```swift
var scalar: Self.Scalar? { get set }
```

## See Also

### Inspecting a shaped array type

- [shape](coreml/mlshapedarrayprotocol/shape.md)
- [strides](coreml/mlshapedarrayprotocol/strides.md)
- [count](coreml/mlshapedarrayprotocol/count.md)
- [isScalar](coreml/mlshapedarrayprotocol/isscalar.md)
- [scalarCount](coreml/mlshapedarrayprotocol/scalarcount.md)
- [scalars](coreml/mlshapedarrayprotocol/scalars.md)
- [withUnsafeShapedBufferPointer(_:)](coreml/mlshapedarrayprotocol/withunsafeshapedbufferpointer(_:).md)
