Blitz (175/176)

From:David McMinn
Date:2 Aug 2001 at 11:19:05
Subject:Re: How do I:

Hi Andrew

> .printtime

This is called a label (you can also have them without the "." in front
or a colon afterwards). You do not need one of these for a function. You
would use a label for a subroutine, and use either Goto or Gosub to call
it.

> ????????? <---- What goes here?

If this is supposed to be the start of your procedure (procedure meaning
either a statement or a function) then you either have:

Statement NameOfStatement{paramater list}

-OR-

Function.type NameOfFunction{parameter list}

You use a statement when you do not need to return any value to wherever
you called it (i.e. jumped to perform the code). A function will return a
value with the type you specify (can be any of the simple types, i.e. .b,
.w, .l, .q, .f or $/.s). This would be the result of your function. For
example, say you had some mathematical forumla that you had to put in a
function - you would obviously return the result of the calculation.

The name can be any unique name for it you want (i.e not the same as a
command, variable, label or another procedure).

The parameter list is where you put variables to catch the values that
are passed when the procedure is called. You specify a variable name and
type for each parameter (you can have up to 6 parameters I think)
separated by commas.

In the case for your code, you are only printing something out, so you
are not returning anything. So you'd use a statement. It also looks like
you would only need 1 paramete, but I'll stick some more in to make an
example :)

Statement ShowTime{tdelay.l, foo.b, ar.w}
> h = Hours
> m = Mins
> s = Secs
>
> Print "Logging data at time ",h, ":", m, ":", s
> Print " with time interval of ",tdelay.l," Seconds"
>
> End ??????? <----- and here?

The same as with your first line of your procedure, in this case it would
be End Statement. If you had made this a function, it would be End
Function.

Also with functions, you are returning a value, so you need to put
"Function Return ..." where ... is replaced by the value you want to
return as the result of this function.

Now, you would call your statement from your program by doing this:

ShowTime{x, y, z}

This would jump to your procedure, run the code inside it and go back to
the main program to after where you called the procedure. x,y,z are the
values you want to pass. Those values of x,y,z will be available in the
function by using the variables tdelay,foo,ar respectively.

If you were using a function, calling it would look like this:

a=ShowTime{x,y,z}

x,y,z are the same as before, but when a function is called like this,
the result of the function gets stored in the variable a.

> The systemdate command was mentioned but WHERE do I find the listing of it
> to even think about using it.
>
> I have the ORIGINAL blitz2 books and the CD somewhere but I find it
> pointless looking there as I don't understand the way they explain the
> commands. Or have I got it wrong?

It seems to be a Blitz command so I guess it should be in the manual
somewhere (although I'm not sure about the original/first versions of the
manuals). You're probably right about the way they explain things in the
manuals though - normally very badly.

If you have the Blitz Support Suite, you can try pressing Right Alt +
Help when the cursor is over the SystemDate command and you should get an
AmigaGuide document explaining it. Alternatively you can try pressing
Right Amiga + Help to get the original explanation (which would be the
same as the one in the manual).



|) /\ \/ ][ |) |\/| c |\/| ][ |\| |\| | dave@blitz-2000.co.uk
http://members.nbci.com/david_mcminn | ICQ=16827694
Practice random acts of intelligence & senseless acts of self control.

---------------------------------------------------------------------
To unsubscribe, e-mail: blitz-list-unsubscribe@netsoc.ucd.ie
For additional commands, e-mail: blitz-list-help@netsoc.ucd.ie