Variable assignment issue...
BlitzMax Forums/BlitzMax Beginners Area/Variable assignment issue...
| ||
I mustn't understand something about the language, because I have no idea why this isn't working. That, or I'm having a bad day ;) This doesn't work... FinalPosX = StartPosX:+OffsetX (error is: Expecting expression but encountered add sign) This does, but seems to return the wrong thing... FinalPosY = (StartPosY = StartPosY + OffsetY) (I get the same error as above without the brackets) Everything is Local, and Int. Have I missed something in the syntax, or do I need to post more code? The rest is very, very basic. |
| ||
Both things are just syntactially wrong! BM only allows you assignement per expression! But in both cases yo have 2 assignements! Either yo have = or :+! -> StartPosX :+ OffsetX FinalPosX = StartPosX I would have bet you already made this error once last week and got that explained |
| ||
Thanks Dreamora, but what's with the whole... I would have bet you already made this error once last week and got that explained ?No, I didn't. I'm just new to things like :+, and didn't realise you can't have an expression sorted and then assigned to a variable in one shot. I blame the manual which doesn't explain this kind of thing. |
| ||
beside C no compiled language allows chain assignements unless I missed that so in the end the exception needs to mention its difference to the norm ... not the normally behaving one Especially I can not remember that it is mentioned that this kind of assignement is allowed. |
| ||
You can use:A = A + 1 or A:+1 Both do the same job. If you want to do A = B + C Then that's pretty much the only way of doing it. |