It allows the compiler to automatically determine the type of a variable based on
the assigned value.
Type Inference
The keyword used to declare a variable whose value cannot be changed once
assigned.
def
The primary selection tool in Nemerle that allows branching based on the
structure, type, or value of data.
match
The keyword used to declare variables that allow for reassignment and
modifications.
mutable
The Polish university where Nemerle originated as an academic project in 2003.
University of Wrocław
In Nemerle, the semicolon (;) is always mandatory, even if the expression is on a
new line.
False – The semicolon is often optional if the expression is on a new line.
Variables in Nemerle are mutable by default.
False – Variables are immutable by default unless declared with mutable.
Nemerle runs directly on hardware without a virtual execution environment.
False – Nemerle runs on the .NET Common Language Runtime (CLR), not
directly on hardware.
Nemerle supports both object-oriented and functional programming paradigms.
True – Nemerle supports object-oriented and functional programming.
The def keyword requires the programmer to explicitly declare the variable type.
False – def enables type inference; explicit typing is optional.
What will be the output of the following code?
def a = 7;
def b = 2;
WriteLine(a + b * 3);
Identify the error in the following code and explain why it occurs.
def x = 5;
x = 10;
WriteLine(x);
The error occurs because x is immutable by default. Reassigning x = 10; is
invalid. To fix it, declare the variable as mutable:
mutable x = 5;
Identify the problem in the following code:
def name : int = “Nemerle”;
Type mismatch error. The variable is declared as int but assigned a string.
Analyze the return logic of the following code. In Nemerle, why is an explicit
return keyword not strictly necessary in this method body?
public GetLogCount() : int
{
def count = 5;
count
}
The last line of a block is the return value. In Nemerle, explicit return is optional
because the result of the last expression in a block is automatically returned.
What is the final boolean value of result, and which specific category of
operators is being used for &&?
def count = (10 > 5) && (5 == 5);
True; Logic (or Boolean) operators. The expression evaluates to true because
both conditions are met, using the Logical AND operator.