[Coco] Simple value inersion in Color Basic

Juan Castro jccyc1965 at gmail.com
Tue Jan 20 15:27:18 EST 2015


(x + y) - x = y

(x + y) - y = x

Yup, bored.


Juan Castro
Enviado do meu Olivetti Programma 101

On Tue, Jan 20, 2015 at 6:24 PM, William Astle <lost at l-w.ca> wrote:

> That works for negative and mixed sign numbers too, in case anyone is
> wondering. For the 1 and -1 case, the sum is 0 so you have "A = 0 - A". For
> -1 and -129, you have "A = -130 - A". (-130--1 = -129, -130--129 = -1).
>
> There is a trivial proof of this concept that I leave as an exercise for
> the bored.
>
>
> On 15-01-20 01:19 PM, Juan Castro wrote:
>
>> If the values are not symmetrical like 1 and -1, all you have to do is use
>> their sum and subtract from the variable. Let's say you want to toggle
>> between 129 and 1:
>>
>> A=130-A
>>
>>
>> Juan Castro
>> Enviado do meu Olivetti Programma 101
>>
>> On Tue, Jan 20, 2015 at 6:08 PM, Nick Marentes <nickma2 at optusnet.com.au>
>> wrote:
>>
>>  Can anyone tell me a really simple way to "invert" the value in a
>>> variable
>>> between 2 numbers?
>>>
>>> Let's say the variable is in A and I want to toggle the value between 1
>>> and -1.
>>>
>>> Color Basic lacks many of the commands I'm use to but there must be an
>>> easy "mathematical" way to do this.
>>>
>>> Nick
>>>
>>>
>>> --
>>> Coco mailing list
>>> Coco at maltedmedia.com
>>> https://pairlist5.pair.net/mailman/listinfo/coco
>>>
>>>
>>
>
> --
> Coco mailing list
> Coco at maltedmedia.com
> https://pairlist5.pair.net/mailman/listinfo/coco
>


More information about the Coco mailing list