First steps in Oberon 
Author Message
 First steps in Oberon

Hello.

This is my first program in BlackBox... And I dont know where are the
errors. If anybody can help me with what I am doing wrong.

Thank you.

Luis Miguel

MODULE Primero;

 IMPORT Out;

 CONST pi=3.1416;

 VAR radio:real;

 PROCEDURE areaCirculo*;

  VAR area:real;

 BEGIN

  area:=pi*radio*radio;
  Out.String("El area del circulo de radio ");
  Out.Real(radio,0);
  Out.String(" es ");
  Out.Real(area,0);
  Out.Ln;
 END areaCirculo;

BEGIN
 radio:=5.0;
END Primero.



Sun, 30 Mar 2003 03:00:00 GMT  
 First steps in Oberon
You must write real in upper case : REAL, and all will work fine. It's the
same thing with all predeclared identifiers.

Regards.

MODULE Primero;

 IMPORT Out;

 CONST pi=3.1416;

 VAR radio:REAL;

 PROCEDURE areaCirculo*;

  VAR area:REAL;

 BEGIN

  area:=pi*radio*radio;
  Out.String("El area del circulo de radio ");
  Out.Real(radio,0);
  Out.String(" es ");
  Out.Real(area,0);
  Out.Ln;
 END areaCirculo;

BEGIN
 radio:=5.0;
END Primero.


Quote:
> Hello.

> This is my first program in BlackBox... And I dont know where are the
> errors. If anybody can help me with what I am doing wrong.

> Thank you.

> Luis Miguel



Sun, 30 Mar 2003 03:00:00 GMT  
 First steps in Oberon
BlackBox automatically shows you where all of your syntax errors
are by putting gray "X's" after each one.  Take your code for instance.
Each place where I put an [X] is where BlackBox puts the error marker.
If you click on the error marker and look at the bottom left hand
corner of the screen you will see a description of the error.
The first two [X]'s give the description "undeclared identifier".
As someone else pointed out this is because Oberon is case sensitive.
The next [X] is "incompatible operands of dydacdic operator".  That's
basically a type mismatch error.  Because Oberon doesn't know what
"real" is it doesn't know what type of variable "radio" is.  The
next two [X]'s are "incompatible assignment" and are caused by the
same problem.  If you fix the type declaration problems by changing
"real" to "REAL" all of the other errors will go away.

MODULE Primero;

  IMPORT Out;

  CONST pi=3.1416;

  VAR radio:real[X];

  PROCEDURE areaCirculo*;
  VAR area:real[X];
  BEGIN
    area:=pi*radio[X]*radio;
    Out.String("El area del circulo de radio ");
    Out.Real(radio[X],0);
    Out.String(" es ");
    Out.Real(area[X],0);
    Out.Ln;
  END areaCirculo;

BEGIN
  radio:=5.0;
END Primero.



Quote:
> Hello.

> This is my first program in BlackBox... And I dont know where are the
> errors. If anybody can help me with what I am doing wrong.

> Thank you.

> Luis Miguel

> MODULE Primero;

>  IMPORT Out;

>  CONST pi=3.1416;

>  VAR radio:real;

>  PROCEDURE areaCirculo*;

>   VAR area:real;

>  BEGIN

>   area:=pi*radio*radio;
>   Out.String("El area del circulo de radio ");
>   Out.Real(radio,0);
>   Out.String(" es ");
>   Out.Real(area,0);
>   Out.Ln;
>  END areaCirculo;

> BEGIN
>  radio:=5.0;
> END Primero.

--
Guns don't kill people...bullets do.

Sent via Deja.com http://www.deja.com/
Before you buy.



Sun, 30 Mar 2003 03:00:00 GMT  
 
 [ 3 post ] 

 Relevant Pages 

1. First step into SQL

2. Advertising: First step!

3. First steps towards standards conformance

4. First step in the REXX world

5. First steps in REXX

6. First steps in unit testing

7. First blundering steps..

8. first steps in vhdl

9. first steps in Scheme

10. First steps with Foundation ISE 3.1i

11. Help with first tentative steps to Assembly lang

12. "a tropical fish" first step

 

 
Powered by phpBB® Forum Software