[Mono-dev] Mono.CSharp: Evaluating math expressions

Petr Onderka gsvick at gmail.com
Tue Jun 26 18:55:56 UTC 2012


Interestingly, it gives another error to me:

> error CS0128: A local variable named `j' is already defined in this scope

But in both cases, the problem is the same: i*j is interpreted as
declaring a variable called j, whose type is a pointer to type i.
This is certainly not what you want, but I'm not sure what else could
you do to avoid this issue.

Your parenthesized version works, because you can't declare a variable
inside parentheses.

Petr Onderka

On Thu, Jun 21, 2012 at 7:35 PM, Fredo Morkel <fmorkel at yahoo.de> wrote:
> I'm trying out Mono.CSharp's evaluator. Why does this simple script work:
>
> int i=2,j=3;
> (i*j);
>
> whereas this gives an error:
>
> int i=2,j=3;
> i*j;
>
> saying "(1,2): error CS0246: The type or namespace name `i' could not be
> found. Are you missing a using directive or an assembly reference?"
>
> An expression like
> i+j;
> or
> i-j;
> work fine. So why does "i*j" NOT work?
>
> Regards,
> Fredo
>
>
>
> --
> View this message in context: http://mono.1490590.n4.nabble.com/Mono-CSharp-Evaluating-math-expressions-tp4650120.html
> Sent from the Mono - Dev mailing list archive at Nabble.com.
> _______________________________________________
> Mono-devel-list mailing list
> Mono-devel-list at lists.ximian.com
> http://lists.ximian.com/mailman/listinfo/mono-devel-list


More information about the Mono-devel-list mailing list