PDA

View Full Version : BooleanPlus: True, False, Maybe!!!



Killerdou
08-16-2007, 12:55 PM
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
08-16-2007, 12:57 PM
?i am stupid i know that but what you mean with it?

Killerdou
08-16-2007, 12:59 PM
you can assign the value maybe to a variable just like true and false... its like inventing your own values

SKy Scripter
08-16-2007, 01:36 PM
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
08-16-2007, 01:37 PM
use green, computers are based of green not yellow;)

Wizzup?
08-16-2007, 01:43 PM
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
08-16-2007, 02:16 PM
True, false, maybe.

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

Killerdou
08-16-2007, 02:18 PM
its just an example... wizzup already made something usefull with it:)

Harry
08-16-2007, 02:20 PM
I love how you phrase it "Maybe!!!"

R0b0t1
08-16-2007, 06:30 PM
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
08-16-2007, 06:35 PM
it was just an example and no its not a boolean anymore, thats why it is a booleanplus :P

R0b0t1
08-16-2007, 06:38 PM
Dang... I was owned.

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

Killerdou
08-16-2007, 06:50 PM
thats for you to find out:) i just want to share my knowledge:)

Markus
08-16-2007, 07:00 PM
Hehe, this owns.
@Wizzup, nice example :)

dvdcrayola
08-17-2007, 06:02 AM
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
08-18-2007, 06:14 AM
Cracked up when I saw the title :p

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

Derek-
08-21-2007, 07:51 AM
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
08-21-2007, 08:56 AM
i got a example


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

end;

Killerdou
08-21-2007, 09:01 AM
huh? how's that een example lol