Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
You never CALL
#11
Hello Betty, for me it is important to clearly show what is happening. The usual exception is when I call a function as an argument to a function, there would be Call be kind of out of place.  Wink

Code: (Select All)
Option _Explicit

Declare Function Nte_Wurzel(n As Double, x As Double) As Double
Declare Function Nte_Potenz(n As Double, x As Double) As Double

Dim As Double n, x

Print
Input "Wurzelexponent: ", n
Input "Radikand      : ", x

Print
Print Using "Die ###.## Wurzel aus ###.## ist: ##.##########"; n, x, Nte_Wurzel(n, x)
Print: Print
Print "Ueberpruefung: Wurzelwert mit demselben Exponenten potenzieren"
Print
Print Using "Wurzelwert ##.########## potenziert mit Exponent ###.## ergibt: ####.######"; Nte_Wurzel(n, x), n, Nte_Potenz(Nte_Wurzel(n, x), n)

End

Function Nte_Wurzel (n As Double, x As Double)

  Dim wurzelx As Double

  wurzelx = x ^ (1 / n)
  Nte_Wurzel = wurzelx
End Function

Function Nte_Potenz (wurzelx As Double, exponent As Double)

  Dim potenz As Double

  potenz = wurzelx ^ exponent
  Nte_Potenz = potenz
End Function
Reply
#12
Betty didn't see that coming...

Pete
Shoot first and shoot people who ask questions, later.
Reply
#13
A bit later someone will arrive whose first post on the forum involves a surprising amount of parenthesis on what is supposed to be only one parameter to pass to a subprogram. "CALL" only adds to that confusion -- to use it or not to use it? But M$QB allowed the parenthesis, what's up with QB64(PE) now, isn't it supposed to be compatible? Sigh...

The title of the topic should be : "YOU NEVER CALLS", because that other one is pretty much non-existent. Hooray for QB64(PE) able to inject C/C++ code through "dot-h" files.

One more thing. I don't like the hating on "LET". It's not needed but it's better not to discuss it because it encourages even more speculation about what BASIC dialect might be better than another.
Reply
#14
(12-01-2022, 11:16 PM)Kernelpanic Wrote: Hello Betty, for me it is important to clearly show what is happening. The usual exception is when I call a function as an argument to a function, there would be Call be kind of out of place.  Wink
Which doesn't actually work on QB64PE... yet.
A function will always require parenthesis around its entire parameter list. Much harder to make it like Lua with only one parameter, but except for table I religiously put the parenthesis.

Code: (Select All)
tu = table_create()
tu:insert{ user = "mnrvovrfc", status = "depressed", month = "December", reason = "Coca Cola and other grinches LOL" }
print(tu[1].reason .. ", your reason is misguided about C_____mas.")

The "table_create()" is a function I wrote in Lua, part of a "library" that I use a lot.

LOL Atlanta Braves could keep Dansby Swanson but lose Coca-Cola, how dare those idiots say they invented Christmas, GRRRRR! (put cussing emoticon here from other forum)
Reply




Users browsing this thread: 1 Guest(s)