Making While Hold using New Input System

I want to make it so that while holding left shift certain code repeats, but then stops when I let go. This is going to be used for sprinting in my game. How would I go around doing this?

I am also fairly new to Unity so I’m not entirely sure if this is the best way to do it but;

What I did was I added an action to the Input Action Asset then set the action type to Value and control type to Analog

Then test it to a script using

isSprinting= _playerInput.Gameplay.Sprint.ReadValue<float>() > 0;

What this does is when you push down your set key for the Sprint action, the _playerInput.Gameplay.Sprint.ReadValue<float>() will return 1. Then you check if it is greater than 0. The isSprinting have a value of true while you are holding the key and false if you let go of the key.