📜 Mewar Functions Examples

← Back to Categories

1. Simple Function

function greet then
  say "Welcome to Mewar"
end

call greet

2. Function with Parameter

function greet with name then
  say "Hello " + name
end

call greet with "Karan"

3. Return Value

function square with n then
  return n * n
end

set result to call square with 5
say result

4. Two Parameters

function add with a,b then
  return a+b
end

set result to call add with 5,6
say result

5. Age Checker

function check_age with age then
  if age >= 18 then
    return "Adult"
  else
    return "Minor"
  end
end

set status to call check_age with 25
say "Status: " + status

6. Maximum Number

function max_num with a,b then

    if a > b then
        return a
    else
        return b
    end

end

set result to call max_num with 50,80

say result

7. Calculator Function

function multiply with a,b then
  return a*b
end

set result to call multiply with 50,80
say result

8. Input Function

function welcome with name then

    return "Welcome " + name

end

set username to ask "Enter Your Name:"
say username

9. Even Odd Function

function evenodd with n then

    if n % 2 is 0 then
        return "Even"
    else
        return "Odd"
    end

end

set total to call evenodd with 10
say total

10. Royal Sum

function royal_sum with a,b then
  return a+b
end

set total to call royal_sum with 10,20
say total