Wikia

FiM++ Community Wiki

Changes: Decrement

Edit

Back to page

(another decrementor)
(Example: Forgot to explain ^^;)
Line 12: Line 12:
 
/>}}{{code|keyword|I would}}{{code|whitespace| }}{{code/experimental|operator|subtract}}{{code|whitespace| }}{{code|variable|Spike}}{{code|whitespace| }}{{code/experimental|operator|from}}{{code|whitespace| }}{{code|variable|cider}}{{code|punctuation|.}}}}
 
/>}}{{code|keyword|I would}}{{code|whitespace| }}{{code/experimental|operator|subtract}}{{code|whitespace| }}{{code|variable|Spike}}{{code|whitespace| }}{{code/experimental|operator|from}}{{code|whitespace| }}{{code|variable|cider}}{{code|punctuation|.}}}}
   
This subtracts {{Code|literal|1}} from the variable {{Code|variable|Spike}} and then from {{code|variable|cider}}.
+
This subtracts {{Code|literal|1}} from the variable {{Code|variable|Spike}} and then from {{code|variable|cider}}, and then subtracts {{code|variable|Spike}} from {{code|variable|cider}}.
   
 
Its Java equivalent is as follows:
 
Its Java equivalent is as follows:

Revision as of 15:44, November 29, 2012

The decrement operator is a special case of subtraction, and subtracts the a number from a variable. This cannot be used on literals or constants. This operator is a single instruction by itself and can only affect one variable at a time.

FDS

Example

Spike got one less.
Icon Warning There was one less cider.
I would Icon Warning subtract Spike Icon Warning from cider.

This subtracts 1 from the variable Spike and then from cider, and then subtracts Spike from cider.

Its Java equivalent is as follows:

Spike--;
cider--;
cider -= Spike;

See Also


Around Wikia's network

Random Wiki