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 8512593
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T04:19:17+00:00 2026-06-11T04:19:17+00:00

so I am having trouble with debugging in OCaml. The problem is that I

  • 0

so I am having trouble with debugging in OCaml. The problem is that I am writing very simple code, but I keep getting a problem that seems easy to fix – i just don’t know how!

    let rec multiplier (int1: int) (int2: int) (int3: int) : int =
    let product : int
if int1 >= int2 then(
    if int1 >= int3 then product = int1 * int2
    else product = int1 * int3
)
else if int2 >= int1 then( 
    if int1 >= int3 then product = int2 * int1
    else product = int2 * int3 
)

I keep getting a red ‘x’ and a squigley line under the first “if” with the error : “Unexpected token: if”

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-06-11T04:19:19+00:00Added an answer on June 11, 2026 at 4:19 am

    Don’t think of = be an assignment; there basically is no assignment in Ocaml (except := used for references).

    Write something like

     let area : int = 
       if side1 >= side2 then ( 
         if side2 >= side3 then side1 * side3
         else side1 * side3
        )
       else if side2 >= side1 then ( 
         if side1 >= side3 then side2 * side1
         else side2 * side3
       )
       else 0 
    

    Remember that the if … then …. else …. construct is an expression; it is more like the ternary ?: conditional operator of C than like its if statement.

    Remember that Ocaml don’t have statements, only expressions. (Its ; operator e.g a;b is similar to C comma operator a,b meaning compute a, discard the result, and compute b giving its result for the whole expression)

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am having trouble with the strtok function. I keep getting a 'bus error.'
I've been having trouble debugging some JavaScript which normally would seem easy to fix.
I am having trouble getting PHP web debugging setup in Eclipse. I am able
I'm new to scheme and am having some trouble debugging my code. ; returns
Hey everyone, I am having a little trouble debugging my code. Please look below:
So I'm debugging some code at work that I didn't write, and I'm having
I'm having trouble debugging test classes when using TestNG Factories. It seems like, when
I'm having trouble debugging a multi-process application (specifically using a process pool in python's
I'm having trouble debugging a C++ program in Eclipse (the latest RC of Helios,
I'm having trouble with debugging a PHP project through NetBeans using XDebug, and was

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.