RealDocs

UKismetMathLibrary::InRange_IntInt

function Engine Blueprint Since 4.0
#include "Kismet/KismetMathLibrary.h"
Access: public Specifiers: staticBlueprintPure

Description

Returns true if Value falls within [Min, Max]. The inclusivity of each bound is independently configurable via InclusiveMin and InclusiveMax.

Caveats & Gotchas

  • The default Blueprint node uses a display Min of 0 and Max of 10 (from the meta tag), but these are only visual hints in the node — there are no clamped defaults at runtime. Pass explicit values.
  • Passing Min > Max does not assert and will simply return false for all values, silently producing unexpected behaviour. Validate your bounds in debug builds.

Signature

static ENGINE_API bool InRange_IntInt(int32 Value, int32 Min, int32 Max, bool InclusiveMin = true, bool InclusiveMax = true);

Parameters

Name Type Description Default
Value int32 The integer to test.
Min int32 Lower bound of the range.
Max int32 Upper bound of the range.
InclusiveMin bool If true, Value == Min is considered in range. true
InclusiveMax bool If true, Value == Max is considered in range. true

Return Type

bool

Example

Validate a grid coordinate C++
if (UKismetMathLibrary::InRange_IntInt(GridX, 0, GridWidth - 1))
{
    ProcessCell(GridX, GridY);
}

Version History

Introduced in: 4.0

Version Status Notes
5.6 stable

Feedback

Was this helpful?

Suggest an edit

Select a field above to begin editing.