QB64 Phoenix Edition
Chat with Me -- HOST - Printable Version

+- QB64 Phoenix Edition (https://staging.qb64phoenix.com)
+-- Forum: Chatting and Socializing (https://staging.qb64phoenix.com/forumdisplay.php?fid=11)
+--- Forum: General Discussion (https://staging.qb64phoenix.com/forumdisplay.php?fid=2)
+--- Thread: Chat with Me -- HOST (/showthread.php?tid=1262)

Pages: 1 2 3 4 5 6 7


RE: Chat with Me -- HOST - Kernelpanic - 12-17-2022

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]


RE: Chat with Me -- HOST - Pete - 12-18-2022

(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