The following warnings occurred:
Warning [2] count(): Parameter must be an array or an object that implements Countable - Line: 795 - File: showthread.php PHP 7.4.33 (FreeBSD)
File Line Function
/showthread.php 795 errorHandler->error





Post Reply 
Dynamically call a function
06-20-2015, 03:47 PM
Post: #1
Dynamically call a function
hi,
I want call a function dynamically, i.e. nameplanet() to call Mercurius(), Saturnus()... giving a variable: nameplanet (:= "Mercuriius" ...)

This code doesn't work:
Code:

  CASE // call constants for planet
  IF nameplanet:="Mercurius" THEN Mercurius(); BREAK; END;
  IF nameplanet:="Venus" THEN Venus();BREAK; END;
  IF nameplanet:="Mars" THEN Mars(); BREAK;END;
  IF nameplanet:="Jupiter" THEN Jupiter(); BREAK; END;
  IF nameplanet:="Saturn" THEN Saturn(); BREAK; END;
  IF nameplanet:="Uranus" THEN Uranus(); BREAK; END;
  IF nameplanet:="Neptunus" THEN Neptunus();BREAK;  END;
  IF nameplanet:="Pluto" THEN Pluto(); BREAK; END;
  DEFAULT data();
  END; // case

It gives "Bad argument type" in my program...

Any hint?

Thanks
Salvo

∫aL√0mic (IT9CLU) :: HP Prime 50g 41CX 71b 42s 39s 35s 12C 15C - DM42, DM41X - WP34s Prime Soft. Lib
Visit this user's website Find all posts by this user
Quote this message in a reply
Post Reply 


Messages In This Thread
Dynamically call a function - salvomic - 06-20-2015 03:47 PM
RE: Dynamically call a function - salvomic - 06-20-2015, 05:01 PM
RE: Dynamically call a function - eried - 06-20-2015, 05:43 PM
RE: Dynamically call a function - salvomic - 06-20-2015, 05:56 PM
RE: Dynamically call a function - debrouxl - 06-21-2015, 07:23 AM
RE: Dynamically call a function - salvomic - 06-21-2015, 12:55 PM
RE: Dynamically call a function - DrD - 06-21-2015, 08:03 PM
RE: Dynamically call a function - salvomic - 06-22-2015, 07:13 AM
RE: Dynamically call a function - salvomic - 06-22-2015, 12:43 PM



User(s) browsing this thread: 1 Guest(s)