Write variable from other function
bearophile
bearophileHUGS at lycos.com
Fri Feb 28 06:36:01 PST 2014
Suliman:
> I continue attempted to become a programmer,
While D is good enough language, but D is large, so I think it's
not the best as first language :-)
> I can't understand how to write/change variable from one
> function by code in another.
In general you can't, and even if you find ways to do it, it's
not a good idea.
A simple solution is to define a struct (or a class), with a
member variable that you can change as you wish.
> http://www.everfall.com/paste/id.php?nqq61th5loq3
D language is too much lax to accept 0/1 as bools, but in general
it's quite better to use true/false literals.
And functions in D start with a lower case letter.
Bye,
bearophile
More information about the Digitalmars-d-learn
mailing list