SRL Archive - Research & Development Lounge

BooleanPlus: True, False, Maybe!!!


Killerdou

2007-08-16 08:55:26


type
BooleanPlus = (True,False,Maybe);

var
X : BooleanPlus;
begin
X := Maybe;
end.
not sure what it is usefull for, but meh:) maybe stuff like


type
SimpleColor = (Red, Greed, Blue, Purple, Yellow, Orrange);

ShowerThoughts

2007-08-16 08:57:08

?i am stupid i know that but what you mean with it?

Killerdou

2007-08-16 08:59:00

you can assign the value maybe to a variable just like true and false… its like inventing your own values

SKy Scripter

2007-08-16 09:36:03

or you can do somthing like this.


program New;
type
TBackGround = (Yellow, Red, Blue, Black, White);
TSetBackGround = Set of TBackGround;

var
BG : TSetBackGround;
begin
BG := [Red, Black];
if (Red in Bg) then Writeln('Red');
if (Black in Bg) then Writeln('Black');
end.

Killerdou

2007-08-16 09:37:08

use green, computers are based of green not yellow;)

Wizzup?

2007-08-16 09:43:35

Type
FoodState = (Raw, Cooked, Burnt);

FoodBitmap = Record
Raw, Cooked, Burnt: Integer;
End;

Food = Record
Name: String;
OutLinePixels: Integer;
FoodBMP: FoodBitmap;
End;

InvFood = Record
Name: String;
State: FoodState;
End;

InvFoodAr = Array Of InvFood;
FoodAr = Array Of Food;

Lol:

Function FoodStateToStr(x: FoodState): String;

Begin
Case x Of
Raw: Result := 'Raw';
Cooked: Result := 'Cooked';
Burnt: Result := 'Burnt';
End;
End;

BTW: The first 'thing' you put (in this case Raw) is the standard value it is given.

PwNZoRNooB

2007-08-16 10:16:33

True, false, maybe.

Sounds nice but you don't need the maybe. It's useless. :(

Killerdou

2007-08-16 10:18:44

its just an example… wizzup already made something usefull with it:)

Harry

2007-08-16 10:20:17

I love how you phrase it "Maybe!!!"

R0b0t1

2007-08-16 14:30:42

If you add maybe, its not a boolean anymore. Its a custom variable.


OWNED!

But, Wizzup? did something that may be useful in the cooking section with your concept.

Killerdou

2007-08-16 14:35:55

it was just an example and no its not a boolean anymore, thats why it is a booleanplus :P

R0b0t1

2007-08-16 14:38:07

Dang… I was owned.

I guess your right, but maybe include an example of how this could be used?

Killerdou

2007-08-16 14:50:04

thats for you to find out:) i just want to share my knowledge:)

Markus

2007-08-16 15:00:39

Hehe, this owns.
@Wizzup, nice example :)

dvdcrayola

2007-08-17 02:02:46

a problem is that you couldnt do

if this then

if this returned as a booleenplus because its not a booleen.. so i cant think of any uses of it…

edit: good idea though

Jason2gs

2007-08-18 02:14:17

Cracked up when I saw the title :p

So… Constants in types? Didn't know you could do that :p

Derek-

2007-08-21 03:51:09

YEEESS thank you!!!

in the new mousebox procedure there was no way to NOT click but you saved me haha nice =]

http://www.villavu.com/forum/showthread.php?t=15741

ShowerThoughts

2007-08-21 04:56:17

i got a example


if FightRandomFound then
begin
maybe
run('n');
writeln('nah dont want to.....')

end;

Killerdou

2007-08-21 05:01:18

huh? how's that een example lol