Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 551131
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 13, 20262026-05-13T11:21:40+00:00 2026-05-13T11:21:40+00:00

Inside my function there is an if() statement like this: if(passedValue < staticValue) But

  • 0

Inside my function there is an if() statement like this:

if(passedValue < staticValue)

But I need to be able to pass a parameter dictating whether the if expression is like above or is:

if(passedValue > staticValue)

But I cant really pass < or > operator in has a parameter, so I was wondering what is the best way to do this?

Also if the language I am using matters its ActionScript 3.0

Thanks!!

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-13T11:21:40+00:00Added an answer on May 13, 2026 at 11:21 am

    Instead of passing an operator, which is impossible in AS3, why not pass a custom comparison function?

    function actualFunction(passedValue:Number, compareFunction:Function) {
        /* ... */
    
        if(compareFunction(passedValue, staticValue)) {
            /* ... Do something ... */
        }
    
        /* ... */
    }
    

    Then to use it:

    actualFunction(6, function(x:Number, y:Number) {
         return x > y;
    });
    

    or:

    actualFunction(6, function(x:Number, y:Number) {
         return x < y;
    });
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Is there php function to remove the space inside the string? for example: $abcd=this
I've got a function inside of a class that returns a string. Inside this
I need to use a function inside of another function, how can I do
This question has been brought up many times, but I'd like to ask it
I've read that static variables are used inside function when one doesn't want the
I have a function inside a class that returns a reference to a member
How can I call a function from inside the function, so it becomes recursive?
If we define a member function inside the class definition itself, is it necessarily
I want to run function inside web service (.asmx file) $.ajax({ type: POST, contentType:
I want to create variables inside a function from a dictionary. Let's say I

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.