# Issues with Print function

**URL:** <https://forums.unrealengine.com/t/issues-with-print-function/831275>\
**Category:** Programming & Scripting\
**Tags:** unreal-editor-for-fortnite, fortnite-creative, question, fortnite\
**Created:** [March 29, 2023, 2:04am UTC](https://forums.unrealengine.com/t/issues-with-print-function/831275 "2023-03-29T02:04:01Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![stratt](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@stratt](https://forums.unrealengine.com/u/stratt)\
**Post date:** [March 29, 2023, 2:04am UTC](https://forums.unrealengine.com/t/issues-with-print-function/831275/1 "2023-03-29T02:04:01Z")

</div>

So I’ve just started dipping my toes into Verse, I come from an experienced developer background and I find myself stumped in messing around with my first Hello World program. Lol. Surely I’m missing something, but in the case that I’m not, I thought I’d share here in case others see the same.

Here is my code:

```auto
hello_world_device := class(creative_device):

    # Runs when the device is started in a running game
    OnBegin<override>()<suspends>:void=
        # TODO: Replace this with your code
        var HelloWorld : []char = "Hello, world!"
        var ColorRed : color = MakeColorFromSRGB(1.0,0.0,0.0)
        var DurationFive : float = 5.0
        var args : tuple([]char, float, color) = (HelloWorld, DurationFive, ColorRed)
        Print(args)
        Print("2 + 2 = {2 + 2}")

```

Very simple, yet I see this bizarre syntax error in VSCode:  
`This function parameter expects a value of type tuple([]char,?Duration:float = ...,?Color:color = ...), but this argument is an incompatible value of type tuple([]char,float,color).`

It’s my understanding that the ‘?’ character prior to the argument in the function definition denotes that the argument is optional. Since I’m providing the correct types, whats the reasoning for this error? Hopefully I’m not missing anything too blatantly obvious here. Thanks!

---

<div class="post-metadata">

**Author:** ![Syz\_n](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Syz\_n](https://forums.unrealengine.com/u/Syz_n)\
**Post date:** [March 29, 2023, 2:51am UTC](https://forums.unrealengine.com/t/issues-with-print-function/831275/2 "2023-03-29T02:51:17Z")

</div>

looking in the Verse.digest.verse file it seems like the duration and color is handled externally. unless a staff wants to correct me i dont think you can change them

```auto
    # Send messages to the default print log. Duration will determine how long the message will remain on the client screen, default 2.0 seconds. Color will determine the color of the message displayed on the client screen, default is White.
    Print<native><public>(Message:[]char, ?Duration:float = external {}, ?Color:color = external {}):void

```

---

<div class="post-metadata">

**Author:** ![MattRix](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/mattrix/32/686548_2.png) [@MattRix](https://forums.unrealengine.com/u/MattRix)\
**Post date:** [March 29, 2023, 3:41am UTC](https://forums.unrealengine.com/t/issues-with-print-function/831275/3 "2023-03-29T03:41:53Z")

</div>

You _can_ use the Color argument with Print(), though worth noting that the color only shows up in the top left of the screen, and not in the log in the game or in UEFN.

The real problem you have is that AFAIK there is no way to put optional/named arguments in a tuple (I’ve tried every syntax I can think of for it, and it just doesn’t work right now… maybe it’s coming in the future?). Also the way Verse works is not like some other languages (ex C#) where you can pass optional arguments in the specified order OR with their names. You _have_ to pass them by name in Verse. So without using the tuple, this is how you do it:

```auto
Print(HelloWorld, ?Duration := DurationFive, ?Color := ColorRed)

```

---

<div class="post-metadata">

**Author:** ![stratt](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@stratt](https://forums.unrealengine.com/u/stratt)\
**Post date:** [March 29, 2023, 12:34pm UTC](https://forums.unrealengine.com/t/issues-with-print-function/831275/4 "2023-03-29T12:34:13Z")

</div>

Thanks for your replies on this folks. @MattRix was correct with his suggestion here.

> Also the way Verse works is not like some other languages (ex C#) where you can pass optional arguments in the specified order OR with their names. You _have_ to pass them by name in Verse.

It would be fantastic if there were a knowledge-base for programmers coming from different common backgrounds. I understand this is still a young language and that would come with time, but wishful thinking at least!

Thanks for the quick resolution with this one.

---

<div class="post-metadata">

**Author:** ![Nestered](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Nestered](https://forums.unrealengine.com/u/Nestered)\
**Post date:** [December 10, 2023, 11:17pm UTC](https://forums.unrealengine.com/t/issues-with-print-function/831275/5 "2023-12-10T23:17:55Z")

</div>

Displays a Green Int for 10 seconds.

using { /Verse.org/Colors }  
var ItemIndex : int = 1;  
Print(“ItemIndex:{ItemIndex}”, ?Duration := 10.0, ?Color := NamedColors.Green)

Hope this helps.
