Download

Constants over Vars in Unrealscript?

I know the obvious difference, in that one can change during gameplay and the other is constant.

However i tend to use vars more often (even when they never change), simply because I can specify explicit types, rather than constants seeming to imply the type based on the value assigned.

For example if i declare


const MyConst = 222

Will the compiled code interpret this as a byte or an int?

Or if I declare


const MyConst =  222.0

Would it be considered a float?

Does anyone know if there is any performance cost of using constants over variables?

Cheers

you have to define them before use, I know you know that. const int MyConst.

For performance local variables over constants.

Hmmm, this is unusual that most consts in the base unrealscript code do not specify a type (although i see some do).

Also @gamepainters, what makes you believe vars are more performant than consts? I would assume the opposite if anything at all.

less intructions. = better performance.