Print a float

Monkey Forums/Monkey Beginners/Print a float

Fryman(Posted 2014) [#1]
How do I get a float to show up in the debug log, ive tried

Local TempVar:String = String(FloatyVariable)
Print(TempVar)


but I always get a cannot convert to string error


Jesse(Posted 2014) [#2]
It works here!
I only tried it in Flash, HTML5 and Desktop.
is FloatyVariable a boxed float?


ImmutableOctet(SKNG)(Posted 2014) [#3]
Technically, you don't need to make a temporary variable, you can just cast (Or let it cast for you, if it's just for debugging purposes; but I'd recommend casting anyway). The 'Print' command is target specific, it'll work no matter what, but the places it outputs to are different between targets.

The standard GLFW / "Desktop" targets, XNA, and the STDCPP / "C++ Tool" all output to most IDEs (Monkey's default will work with this). This would be the standard output stream, and the IDE would read from it.

If you're not seeing the output, maybe your console isn't enabled? If you're using Monkey's default IDE, press your escape key to toggle it.

Here's an example:


You should be doing it right, so I don't know why it isn't working for you.


Fryman(Posted 2014) [#4]
Its started working ive made no changes other than reloading the IDE..


ImmutableOctet(SKNG)(Posted 2014) [#5]
Well, as long as it works. It's possible you were just having issues from external output (The native compiler's output) or something.