SRL Archive - OSR Help

Same Line Coding


RISK

2011-01-05 21:26:23

Thank you in advance for any help given or attempted.


begin
case (I) of
0 : Color := 0; HMod := 0.0; SMod := 0.0;
1 :
begin
Color := 0;
HMod := 0.0;
SMod := 0.0;
end;
end;
end;

I want to make it to where I only have to use one line for adjusting variables or just doing functions and such, like I did on the first one. But that does not work and only the second one works. Is there a way to make it work that I am just missing or something?

Thank you again.

Train

2011-01-05 21:40:46

0: begin Color := 0; HMod := 0.0; SMod := 0.0; end;
???

KingKong

2011-01-05 21:45:39

From: RISK
Thank you in advance for any help given or attempted.


begin
case (I) of
0 : Color := 0; HMod := 0.0; SMod := 0.0;
1 :
begin
Color := 0;
HMod := 0.0;
SMod := 0.0;
end;
end;
end;

I want to make it to where I only have to use one line for adjusting variables or just doing functions and such, like I did on the first one. But that does not work and only the second one works. Is there a way to make it work that I am just missing or something?

Thank you again.


The first way does not work because the semicolon signifies the end of a statement. If you want more than one thing to be done you have to put them between a begin and an end, like you did in your second method

RISK

2011-01-05 21:49:41

@ Kong : Thank you for helping.

@ Train : I feel like an idiot for not thinking of doing that. Thank you for helping.

Train

2011-01-05 21:50:22

From: RISK
@ Kong : Thank you for helping.

@ Train : I feel like an idiot for not thinking of doing that. Thank you for helping.


<3.

**BANNED The Man

2011-01-06 03:01:26

Im bored xD here is something you MAY use…
function SetColor(ColorX, HModX, SModX : integer) : boolean;
Begin
If Color := ColorX then
If HMod := HModX then
If SMod := SModX then
Result := True;
End;

I just looked back at your original function and realised i dont think this it what you wanted… Haha.
Oh well anyone use as they please :)

-Boom

TomTuff

2011-01-06 03:29:14

terrible standards, risk!

RISK

2011-01-06 03:31:29

What. Really? I thought my standards were fine. What's wrong with them?!

From: TomTuff
terrible standards, risk!

TomTuff

2011-01-06 03:33:46

having all those statements on one line.

RISK

2011-01-06 03:39:11

But it saves coding space than spending about 5+ lines of coding just to set the variables to find where the character is at.

I feel.. Dirty for using apparent bad standards. I don't know why.

From: TomTuff
having all those statements on one line.


E: I'll just do the proper way of doing it, even if it does take up more space than it should.
Thank you to everyone for helping.

3Garrett3

2011-01-06 11:19:24

From: RISK
But it saves coding space than spending about 5+ lines of coding just to set the variables to find where the character is at.

I feel.. Dirty for using apparent bad standards. I don't know why.


I usually don't put multiple lines of code on one line, but it's not really bad standards. It is a little tougher to read through the code though, say in an app ;).

I'm perfectly fine with having some words this way, for example:

end else begin
***Stuff
end;

looks perfectly okay for me.

Sir R. M8gic1an

2011-01-06 14:27:29

Your standards are just fine

~RM