so a statement like:
if node: node.do_a(); node.queue_free(); node = null
will throw an exception but
if node: node.do_a() node.queue_free() node = null
doesn't
do_a() can only effect child nodes, at best
godot 3.3
I'm not sure, but I think the one liner only uses the if for the first statement. So if would be like this:
It would make sense. Thanks.
Hmm, but I wonder... what if you add tabs for each of the new lines?
if node: node.do_a();<tab here>node.queue_free();<tab here>node = null
I tried, that doesn't seem to work. It seems tabs only work at the beginning of the line.
This does seem to work, though.
if node: node.do_a(); node.queue_free(); node = null;
But I think it's kind of ugly and not as clear as the normal version.
Well, ugly is probably subjective and if you are feeling a dire need to save vertical space it still does the job. :)
@cybereality yet I find parsing working that way inconsistent then. It is a semicolon terminated statement inheriting indentation differently based on the initial statement's starting context.
Perhaps bring it up on the proposals repo if you feel strongly about it? Search it first though.
https://github.com/godotengine/godot-proposals/issues
I used to like one liners. I'd have some crazy stuff going on in one line. It worked, but it was hell when I had to go back to the project 6 months later and decipher whatever it was I was thinking.
But I agree this seems somewhat confusing and might be worth fixing.
I keep one liners simple. About as simple as above. Some of it is due to working from a laptop. Vertical space is at a premium