Breaking News: Grepper is joining Read the official announcement!
Check it out

Challenge: Max with Nested Functions

Sumit Rawal answered on May 23, 2023 Popularity 1/10 Helpfulness 1/10


More Related Answers

  • Solution Review: Max with Nested Functions

  • Challenge: Max with Nested Functions


    Problem Statement

    In this challenge, you need to create a nested function max which will be defined in the body of the function mainMax. mainMax returns the maximum of three numbers using the max function.

    You will need to write the max function from scratch. Take some time and try to figure out how many parameters it should have and what the return value will be. You will also need to figure out what mainMax will return. Remember how in the previous lesson sqrt was returning the return value of sqrtIter.


    The inputs of the mainMax function are three numbers a, b, and c of type Int.


    The output will be the maximum of a, b, and c.

    Sample Input


    Sample Output


    Test Yourself

    Write your code in the given area. Try the exercise by yourself first, but if you get stuck, the solution has been provided. Good luck! 

    Popularity 1/10 Helpfulness 1/10 Language scala
    Source: Grepper
    Tags: max scala
    Link to this answer
    Share Copy Link
    Contributed on May 23 2023
    Sumit Rawal
    0 Answers  Avg Quality 2/10


    Continue with Google

    By continuing, I agree that I have read and agree to Greppers's Terms of Service and Privacy Policy.
    Grepper Account Login Required

    Oops, You will need to install Grepper and log-in to perform this action.