SRL Archive - Help and Support

Can scar use "public" variables?


R0b0t1

2007-09-02 21:06:59

Like, if you declare a variable in a function, can you make it global?


Function Something: Boolean;
var
public Booleantwenty: Boolean;
. . .


Asking because I saw that SCAR syntax highlighter catches "public" and "private".

Go try it and type public and private into SCAR, it highlights them.

EDIT: Can SCAR use 0 and 1 as Boolean values?

R0b0t1

2007-09-02 21:28:00

Well, c0de, does doing it as I used above work, or must I do a different configuration when I declare them? (The "public" variables of course.)



EDIT: Nope, no 0/1 for booleans.

Bobarkinator

2007-09-03 00:11:21

program New;

procedure GlobalVar;
var
public Hi: String;

begin
Hi:='This should write in other proc.';
end;

procedure WriteGlobalVar;
begin
WriteLn(Hi);
end;

begin
GlobalVar;
WriteGlobalVar;
end.

That doesn't work. Unless I am using it incorrectly.

Edit: Lol drunkenoldma missed public and private for bolding when using the Scar tag.

Edit2: I even tried putting the public after the variable name.

Santa_Clause

2007-09-03 00:58:30

So why would you bother making a public variable if you can just make it global?

Pancakes

2007-09-03 02:19:11

Messier coding etc.

Could come in handy.

Starblaster100

2007-09-03 04:11:43

As c0de said, its the same as global and local.

If you want to use numbers for booleans, you would have to use integeres and code as if they were booleans.

[php]
Number := 1;
If (Number = 1) then
[/php]

but i don't see the point really

R0b0t1

2007-09-03 16:19:22

SB, that wasn't the point. I could have used it to make a function with two results, one that would return 0 or 1, or something else. (Pending on a choice).

~alex~

2007-09-03 16:38:54

function functionname :integer; ?

The just make it return a different number based on the outcome.

R0b0t1

2007-09-03 19:05:58

RARG! I KNOW THAT! But I wanted to make sure someone wouldn't have to make an IntToBool function.