Jump to content
shadowrecon

Question about Formatting

Recommended Posts

Okay so im trying to get the formatting correct so everything looks a bit more uniform, would come one take a look at this function and tell me if its in the proper format?

Procedure ChangeDir;
 Var
 CurrentPos: Extended;
begin
 CurrentPos := Round(GetCompassAngleDegrees);
 Status('Your Current Angle is ' + FloatToStr(CurrentPos));
 if ((CurrentPos < 270) and (CurrentPos  > 90)) then
  begin
     MakeCompass(Dir_North);
  end;
 if ((CurrentPos > 270) or (CurrentPos < 90)) then
  begin
     MakeCompass(Dir_South);
  end;
end; 

or does it need to look like this..

Procedure ChangeDir;
 Var
 CurrentPos: Extended;
begin
 CurrentPos := Round(GetCompassAngleDegrees);
 Status('Your Current Angle is ' + FloatToStr(CurrentPos));
 if ((CurrentPos < 270) and (CurrentPos  > 90)) then
   begin
     MakeCompass(Dir_North);
   end;
    if ((CurrentPos > 270) or (CurrentPos < 90)) then
      begin
        MakeCompass(Dir_South);
      end;
end; 

i just get lost on the ifs, where and when do i tab

Link to comment
Share on other sites

i just skimmed through all that, and with hardly any luck did it explain the if statements, and if that are brought back to the same line or pushed further out. id just like a simple yes or no on one of those examples. would help out greatly! =)

 

Also another question is there a way to initialize and set up a variable at the same time like in C it was used like so:

 

int blah = 0;

 

this way its defined and set to a value at the same time as im having to define some variables to what i want them to be when if i could only initialize them and and set them it would save lines =)

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.



×
  • Create New...