1 // Int 2 auto vInt = Value(42); 3 vInt /= 2; 4 assert(vInt == 21); 5 vInt *= 4; 6 assert(vInt == 84); 7 vInt -= 4; 8 assert(vInt == 80); 9 vInt += 20; 10 assert(vInt == 100); 11 12 // Float 13 auto vFload = Value(42.0); 14 vFload -= 1.0; 15 assert(vFload == 41.0); 16 vFload /= 2.0; 17 assert(vFload == 20.5); 18 vFload += 10.0; 19 assert(vFload == 30.5); 20 vFload *= 2.0; 21 assert(vFload == 61.0); 22 23 // bytes 24 ubyte[] b1 = [1, 2]; 25 ubyte[] b2 = [3, 4]; 26 ubyte[] b3 = [1, 2, 3, 4]; 27 auto vBytes = Value(b1); 28 vBytes ~= b2; 29 assert(vBytes == b3); 30 31 // string 32 auto vStr = Value("Hello"); 33 vStr ~= " world!"; 34 assert(vStr == "Hello world!"); 35 36 // Array 37 auto vArray = Value(["abc", "def", "xyz"]); 38 vArray ~= "foo"; 39 assert(vArray == Value(["abc", "def", "xyz", "foo"])); 40 vArray ~= Value(["fuz", "buz"]); 41 assert(vArray == Value(["abc", "def", "xyz", "foo", "fuz", "buz"]));