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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T13:22:56+00:00 2026-06-17T13:22:56+00:00

I am strugging a bit to implement a nested if else expressions in SML.

  • 0

I am strugging a bit to implement a nested if else expressions in SML. Can anyone highlight its syntax. Suppose there are three conditions C1, C2, C3 I need equivalent of following in C code.

if (C1) { 
    return true;
}
else {
    if(C2) {
        return true;
    }
    else {
         if (C3) {
             return true;
         }
         else {
             return false;
         }
    }
}

I tried the following, but its treated as “if, else if, and else” cases

if C1 then true
else if C2 then true
else if C3 then true
else false
  • 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-17T13:22:57+00:00Added an answer on June 17, 2026 at 1:22 pm

    You’re correct. Two code fragments are equivalent.

    With a bit of indentation, your SML example looks more like using nested if/else:

    if C1 then true
    else
        if C2 then true
        else
            if C3 then true
            else false
    

    You could also use parentheses so that SML example looks almost the same as C example but it isn’t necessary.

    Of course, the most idiomatic way in SML is to write

    C1 orelse C2 orelse C3
    

    You could use the same trick for your C code. Remember that returning true/false in if/else blocks is code smell.

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

Sidebar

Related Questions

I'm strugling a bit with old libs and can't seem to get from QRCodeWriter
(Really strugging to title this question, so if anyone has suggestions feel free.) Say
I am struggling a bit to understand how the new AAA syntax works in
I'm still struggling a bit with the idea of ARC. Let's suppose I have
I've searched a bit for this and tried to implement a self-made solution but
Could anyone explain what's good about OAuth2 and why we should implement it? I
I'm a bit new to ajax and am strugging with a few things I
struggling a bit to get the following to work : I'm trying to merge
I'm currently struggling a bit trying to keep my controller specs DRY and succinct
I've been struggling a bit with this tiny problem - and I'm quite sure

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.