# TypeOf() or GetType() in Verse?

**URL:** <https://forums.unrealengine.com/t/typeof-or-gettype-in-verse/1416453>\
**Category:** Verse\
**Tags:** unreal-editor-for-fortnite, question, fortnite\
**Created:** [November 24, 2023, 6:14am UTC](https://forums.unrealengine.com/t/typeof-or-gettype-in-verse/1416453 "2023-11-24T06:14:13Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![SGMosquito](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@SGMosquito](https://forums.unrealengine.com/u/SGMosquito)\
**Post date:** [November 24, 2023, 6:14am UTC](https://forums.unrealengine.com/t/typeof-or-gettype-in-verse/1416453/1 "2023-11-24T06:14:13Z")

</div>

I obtained the following sorting code sample through Googling:

```auto
Sort(Items : []t, IsAscending : logic, Comparer: type{_(:t, :t)<computes> : int} where t : type)<computes> : []t = 
    if (Items.Length > 1, Pivot := Items[Floor(Items.Length/2)]):
        Left := for(Item : Items, Comparer(Item, Pivot) < 0) do Item 
        Middle := for(Item : Items, Comparer(Item, Pivot) = 0) do Item
        Right := for(Item : Items, Comparer(Item, Pivot) > 0) do Item
        if(IsAscending?):
            Sort(Left, IsAscending, Comparer) + Middle + Sort(Right, IsAscending, Comparer)
        else: 
            Sort(Right, IsAscending, Comparer) + Middle + Sort(Left, IsAscending, Comparer)
    else:    
        Items 

```

Here, I added the following methods to simplify the sorting code for the main types:

```auto
#Sort Methods By Type
CompareInts<internal>(A : int, B : int)<computes>: int = 
    if(A < B) then -1
    else if(A > B) then 1
    else 0

CompareFloats<internal>(A : float, B : float)<computes>: int = 
    if(A < B) then -1
    else if(A > B) then 1
    else 0

(Items:[]int).SortInts(IsAscending : logic):[]int = 
    Sort(Items,IsAscending,CompareInts)

(Items:[]float).SortFloats(IsAscending : logic):[]float = 
    Sort(Items,IsAscending,CompareFloats)

```

If I name both SortInts and SortFloat as Sort, it outputs a compiler error saying,

> The function operator’.Sort’(:float,:tuple(),:logic) is ambiguous with this definition: function operator’.Sort’(:int,:tuple(),:logic) (3532)  
> It was inconvenient because I couldn’t handle functions with the same name even if the parameters were different.

Therefore, I want to implement a single function Sort(:t,:logic) that automatically handles according to the type of Items using parametric.  
Is there a function like TypeOf() or GetType() that can check the type of Items, or is there another way?
