Chat with Me -- HOST
#61
This is how one can see it even better (Also calculates the value added tax.):

Code: (Select All)
$Console:Only
Option _Explicit

Declare Function satzErgaenzen(satz As String) As String
Declare Function prozentErhoehung(kaufpreis As double) As Double

Dim As String eingabe
Dim As Double kaufpreis

Print
Input "Geben Sie -Hallo- ein, ich ergaenze den Satz: ", eingabe
Print
Print satzErgaenzen(eingabe)

Print: Print
Input "Kaufpreis: ", kaufpreis
Print
Print Using "Der Endpreis plus 15.75% Mehrwertsteuer betraegt: ###.##"; prozentErhoehung(kaufpreis)
End

Function satzErgaenzen$ (satz As String)

  satz = satz + " Fans von QB64!"
  satzErgaenzen = satz
End Function

Function prozentErhoehung (kaufpreis As Double)

  Dim As Double endpreis, mehrwertSteuer

  mehrwertSteuer = 15.75
  endpreis = ((kaufpreis / 100) * mehrwertSteuer) + kaufpreis
  prozentErhoehung = endpreis
End Function

[Image: Endpreis-Strings2022-12-17-230359.jpg]
Reply
#62
(12-17-2022, 08:54 PM)Kernelpanic Wrote: I think I know the reason now - the extra type declaration is only necessary for strings.

(Enter -Hello-, I will complete the sentence)
Code: (Select All)
Option _Explicit

Declare Function satzErgaenzen(satz As String) As String

Dim As String eingabe

Print
Input "Geben Sie -Hallo- ein, ich ergaenze den Satz: ", eingabe
Print
Print satzErgaenzen(eingabe)

End

Function satzErgaenzen$ (satz As String)

  satz = satz + " Fans von QB64!"
  satzErgaenzen = satz
End Function

> I think I know the reason now - the extra type declaration is only necessary for strings.

Yes, that's correct.

Well, at least Steve's chat program has found a good use... chatting at the forum about coding functions! Big Grin Big Grin Big Grin
Reply




Users browsing this thread: 22 Guest(s)