Question about Constants / Variables in Spin
CassLan
Posts: 586
Hi all,
If I define a constant as the sum of two variables:
As I change the values of VAROne and VARTwo, will the value of VARSUM change automatically?
Or would I have to make VARSUM a variable and update its value as VAROne and VARTwo change?
I would test this but am not near a setup right now, and am making some outlines for a program.
Thanks,
Rick
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
NYC Area Prop Club
Prop Forum Search (Via Google)
·
If I define a constant as the sum of two variables:
CON VARSUM = VAROne + VARTwo VAR Byte VAROne, VARTwo
As I change the values of VAROne and VARTwo, will the value of VARSUM change automatically?
Or would I have to make VARSUM a variable and update its value as VAROne and VARTwo change?
I would test this but am not near a setup right now, and am making some outlines for a program.
Thanks,
Rick
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
NYC Area Prop Club
Prop Forum Search (Via Google)
·
Comments
OBC
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
New to the Propeller?
Visit the: The Propeller Pages @ Warranty Void.
CON
VARSUM = VAROne + VARTwo
It is simply a reference, something easy to remember.
If you calculate something with a constant, then use that constant in your program, the value result of the calculation will be put into the program just as if you had typed it in.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Propeller Wiki: Share the coolness!
Chat in real time with other Propellerheads on IRC #propeller @ freenode.net
Safety Tip: Life is as good as YOU think it is!
Ok, I see, at compile time it replaces chunks of my program with the appropriate values for the constants, its merely a human aid in writing the software.
Thanks!
Rick
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
NYC Area Prop Club
Prop Forum Search (Via Google)
·