Standalone ternary operations don't work despite manual claiming otherwise #2682
Closed
1 of 2 tasks
Labels
docs-bug
GameMaker Manual Bugs
Description
On the gml manual page 'if / else and Conditional Operators', the example shows a ternary operation being used without being part of a variable assignment.
The specific example is the third line of code here:

That line implies that it's possible to use ternary operators for standalone 'if-else' shortcuts (as is standard for many languages).
However when copy/pasting that line in, or trying any other variation, for example:
(instance_exists(obj)) ? instance_destroy() : instance_create_depth(x, y, 0, obj);
You are just met with this feather error
GM1007 Left-hand side of an assignment must be a variable.
, which prevents compiling the game.Expected Change
No response
Steps To Reproduce
Copy & paste in the code from the manual:
(--hp <= 0) ? instance_destroy() : score += 10;
into a project.Gamemaker will then prevent compiling.
How reliably can you recreate this issue using your steps above?
Always
Which version of GameMaker are you reporting this issue for?
2023.11.1 (Monthly)
Which operating system(s) are you seeing the problem on?
Windows 10
Are you running GameMaker from inside your Steam library?
None
Contact Us Package Attached?
Sample Project Added?
The text was updated successfully, but these errors were encountered: