CONSTANT and IF together not possible?
Monkey Forums/Monkey Bug Reports/CONSTANT and IF together not possible?
| ||
Is this a bug or a feature? If I use a constant MY_DEMO I cannot use it together with an IF statement: Strict Import mojo Const MY_DEMO:Bool=TRUE Class Game Extends App Method OnCreate%() SetUpdateRate 60 If MY_DEMO=True Endif Return 0 End ..... this code results in an error message: Monkey Runtime Error : C:/Monkey/Duett/test.monkey<10> : Internal error I thought it would be allowed like... IF 1=1 |
| ||
What about trying to cast it as a bool? Not on a machine with monk at the moment. If bool(MY_DEMO=True) |
| ||
That looks like a bug to me, raise it in the bug forum. (Edit: Was I tired last night or has this thread been moved?) |
| ||
Could you please post a complete, runnable example? This works here: Strict Import mojo Const MY_DEMO:Bool=TRUE Class Game Extends App Method OnCreate%() SetUpdateRate 60 If MY_DEMO=True Print "Hello!" Endif Return 0 End End Function Main:Int() New Game Return 0 End |
| ||
Hi Mark, your code does not work on my V69 . This is the log: "C:/MonkeyPro69/bin/transcc_winnt" -target=Html5_Game -config=Debug -run "C:/Monkey/Schrott/t.monkey" TRANS monkey compiler V1.46 Parsing... Semanting... C:/Monkey/Schrott/t.monkey<9> : Internal error Monkey Runtime Error : C:/Monkey/Schrott/t.monkey<9> : Internal error (null) STOPPED Monkey Runtime Error : C:/Monkey/Schrott/t.monkey<9> : Internal error (null) Done. Perhaps the problem was already solved in the V7xx versions... Thank you |
| ||
Read This: http://www.monkeycoder.co.nz/Community/posts.php?topic=4434 TLDR; Upgrade your Monkey version |