constant local

Omni

Ultra Cool Member
Reaction score
37
can you have a constant local? as in

Code:
constant local integer i = 0

just wondering, not that it would ever be of any use :p
 
Reaction score
456
JASS:
constant function constant_integer takes nothing returns integer
    return 0
endfunction

function use_constant_integer takes nothing returns nothing
    local integer i = constant_integer()
endfunction


In a way yes..? I just don't see use for this :p
 
Reaction score
456
JASS:
globals
    constant real fullangle = 360.00
    constant real halfangle = 180.00
    constant real quarterangle = 90.00
endglobals


like thattie :cool:.. But then they are no locals, they're globals :p
 

~GaLs~

† Ғσſ ŧħə ѕαĸε Φƒ ~Ğ䣚~ †
Reaction score
180
JPS forgoten to take that as false ? :p:p:p
But jasscraft do
 

quraji

zap
Reaction score
144
Simply, you can not declare a local variable as a constant. A constant just isn't a variable.
You can assign a variable a value based on a literal constant, meaning a value that does not ever change:

JASS:
local integer int = 1

1 would be the literal constant in this case, 
1 can never be any other value than 1,
this is what makes it a constant.
 

SFilip

Gone but not forgotten
Reaction score
634
Out of curiosity...any point in having constant locals in the first place?
Most likely the only reason why constant globals exist is so that people wouldn't mess with the ones defined in common.j and blizzard.j. The fact JassHelper allows you to define these was definately not something blizzard intended.
 

quraji

zap
Reaction score
144
There would be no point to them if they did exist, which is why they don't ^_^
 
General chit-chat
Help Users
  • No one is chatting at the moment.

      The Helper Discord

      Members online

      No members online now.

      Affiliates

      Hive Workshop NUON Dome World Editor Tutorials

      Network Sponsors

      Apex Steel Pipe - Buys and sells Steel Pipe.
      Top