RealDocs

UKismetMathLibrary::Subtract_IntInt

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

Description

Subtracts integer B from integer A and returns the difference. The default B=1 makes it a convenient decrement node in Blueprint graphs.

Caveats & Gotchas

  • No underflow protection: INT_MIN - 1 wraps to INT_MAX silently. Clamp or use int64 when the result could go below -2.1 billion.
  • Same hidden-default pitfall as Add_IntInt: leaving B unconnected in Blueprint silently subtracts 1 rather than 0, which may not be intended.

Signature

static UE_INL_API int32 Subtract_IntInt(int32 A, int32 B = 1);

Parameters

Name Type Description Default
A int32 Minuend.
B int32 Subtrahend. 1

Return Type

int32

Example

Decrementing lives C++
Lives = UKismetMathLibrary::Subtract_IntInt(Lives, 1);
if (Lives <= 0) { GameOver(); }

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.