Monday, April 19, 2010

Function type in haXe

Functions are integral part of haXe. We can’t think of haXe without functions. It must contain at least the Main() function. A function is a code block of a program that perform a specific task and which is independent of remaining code block.
The syntax for function definitions are like the following:
Access-modifier function function-name(var-name:type):return-type{}
Here access-modifier may be public, private for the function function-name with argument var-name of type. This function will return return-type.
Like objects, HaXe functions are typed. Their type depends on two things:
• The arguments taken by the function.
• The return type of the function.
For example, we have the following function,
public function prime(even : String, odd : String) : Int
Here the function prime has arguments even and odd of type string. This returns an Int type. We can denote this as:
We can even take a function as an argument to our function. And also can return a function. let’s take a look at the following function:
public function prime(even : String, odd : String->Int) : Int
We can write this like:
Ok, now we will show a function which accepts the above arguments but returns a function with two arguments of type Int and returns a String. So, the function is like:
function m2(arg1 : String, arg2 : String->Int) : Int->Int->String;
Now let’s see how we will write that:
See the book OpenCart 1.4 Template Design Cookbook.
See the book Joomla Mobile Development Beginners Guide

List of my works:

Technical Support:

If you still face the technical problem, please get support of our highly skilled technical team:

Wordpress Plugins:
  1. Real-Time Health Data from Every Where:WP plugin to display real-time health data & increase sale by promoting user specific products according to health information:
  2. Woocommerce Stock Notification Builder:Sends desktop, mobile & email notifications with full customization.Build your own product notification system with it:

Opencart Extensions:

  1. Product Based Quantity Wise Shipping: Find it here.
  2. OpenSSLCOMMERZ: integrate SSLCOMMERZ with opencart: Find it here.
  3. Fine Search v.1.0 - Improves Opencart search feature to find relevant: Find it here.
  4. Opensweetcaptcha - An easy way to generate attractive captcha for your system!: Find it here.
  5. Custom Field Product - add unlimited custom fields to the product form: Find it here.
  6. Formcaptcha - add captcha on the register page: Find it here.

My Books:

  1. OpenCart 1.4 Template Design Cookbook.
  2. Joomla Mobile Development Beginners Guide

No comments: