Forum > Windows

Measurement converter in Pascal

<< < (2/4) > >>

dzoole:
Like I said i'm newbie at this, so it's probably my mistake.


VTwin:
"result" is the return of a function. Make a function to call in your program.
"miles" is not defined.
A program is terminated with "."

Josh:
hi dzoole

you have messed up winni code;

if you look it is not the same..
you have implementation section in the function code.

the function code should be seperate to the implementation interface etc


--- Code: Pascal  [+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i < x.length; i++) { x[i].style.maxHeight='none'; x[i].style.height = Math.min(x[i].clientHeight+15,306)+'px'; x[i].style.resize = "vertical";}};} --- // declares these functions/procedures as they could be used before they have been defined// ie if you had a function/procedure that called another one that was further down your program code.// you must only add the function/procedure definition; it must match exactly the actual function/procedure definition// and have no actual code in it. Function MilesToKm (miles: string) : string; implementation Function MilesToKm (miles: string) : string;var i : integer;    mileVal, kmVal : single;    tmp : string;begin  tmp := '';  for i := 1 to length(miles) do      if miles[i] in ['0'..'9','.'] then tmp := tmp+miles[i];  mileVal := strToFloat(tmp);  kmVal := 1.609344 * mileVal;  // kmVal := 1.852 * mileVal; ==>nautic mile  result := FloatToStr(kmVal)+' Kilometer';end; // all other functions here  {$R *.lfm}     
can you see the difference

dzoole:
Like i said its probably my mistake. Now, in which file i should paste wiini's code?
In Lazarus ->File->New-> and then what? Pascal Unit?

In Subtitle Workshop, software for subtittles where I want to use the pascal script, i get this.

dzoole:
According to this, i'm not on the right path.
https://docwiki.embarcadero.com/Libraries/Sydney/en/System.ConvUtils

 

Navigation

[0] Message Index

[#] Next page

[*] Previous page

Go to full version