1. Does Euphoria have a null statement?

All,

Does Euphoria have a null statement?  That is a statement which just does 
nothing but is occasionally useful as a place holder during program 
development?

As an example in C I might write something like:

    if (mode == MODE_TEXT)
      ;
    else if (mode == MODE_HTML)
      process_html();
    else
      invalid_mode(mode);

The ; on it's own is C's null statement (well the ; is actually a statement 
terminator and there is no statement but lets not get bogged down in this 
stuff smile  Later while writing the code I might get round to updating it to:

    if (mode == MODE_TEXT)
      process_text;
    else if (mode == MODE_HTML)
      process_html();
    else
      invalid_mode(mode);

In Euphoria I could write a procdure called donothing as follows:

  procedure donothing()

  end procedure

and then convert the above C code to the following Euphoria code:

  if MODE = MODE_TEXT
    donothing()
  elsif MODE = MODE_HTML
    process_html()
  else
    invalid_mode(mode)
  end if

but this seems a little "odd".  Is there something I could use instead of the:

  donothing()

I wonder - any ideas?

Regards,

FP.


 Create a new mailbox, or access your existing IMAP4 or
 POP3 mailbox from anywhere with just a web browser.

new topic     » topic index » view message » categorize

2. Re: Does Euphoria have a null statement?

FP,

Your C code:
 if (mode == MODE_TEXT)
      ;
else if (mode == MODE_HTML)
      process_html();
else
      invalid_mode(mode);

becomes the following Euphoria code:



The absence of a stetement between then and else, elsif, or endif is
perfectly legal--I leave the blank space to remind me to put somthing there,
I could also insert a comment as follows:

if mode=MODE_TEXT then
    --process_text()
elsif mode=MODE_HTML then
    process_html()
else
    invalid mode(mode)
end if

using the intended name for my routine--then when it is written, I merely
have to remove the comment indicator (--).

-- Mike Nelson

new topic     » goto parent     » topic index » view message » categorize

3. Re: Does Euphoria have a null statement?

On Fri, May 04, 2001 at 06:00:57AM -0400, freeplay at mailandnews.com wrote:
> 
> 
> All,
> 
> Does Euphoria have a null statement?  That is a statement which just does 
> nothing but is occasionally useful as a place holder during program 
> development?
> 
> As an example in C I might write something like:
> 
>     if (mode == MODE_TEXT)
>       ;
>     else if (mode == MODE_HTML)
>       process_html();
>     else
>       invalid_mode(mode);
> 
> The ; on it's own is C's null statement (well the ; is actually a statement 
> terminator and there is no statement but lets not get bogged down in this 
> stuff smile  Later while writing the code I might get round to updating it to:
> 
>     if (mode == MODE_TEXT)
>       process_text;
>     else if (mode == MODE_HTML)
>       process_html();
>     else
>       invalid_mode(mode);
> 
> In Euphoria I could write a procdure called donothing as follows:
> 
>   procedure donothing()
> 
>   end procedure
> 
> and then convert the above C code to the following Euphoria code:
> 
>   if MODE = MODE_TEXT
>     donothing()
>   elsif MODE = MODE_HTML
>     process_html()
>   else
>     invalid_mode(mode)
>   end if
> 
> but this seems a little "odd".  Is there something I could use instead of the:
> 
>   donothing()
> 
> I wonder - any ideas?
Try this:
   if MODE = MODE_TEXT
     --nothing here
   elsif MODE = MODE_HTML
     process_html()
   else
     invalid_mode(mode)
   end if
Eu doesn't care if you have a statment or not, also long as the structure is
properly terminated.
> 
> Regards,
> 
> FP.
jbrown
> 
> 
>  Create a new mailbox, or access your existing IMAP4 or
>  POP3 mailbox from anywhere with just a web browser.
How?
> 
> 
> 
> 

-- 
Linux User:190064
Linux Machine:84163
http://jbrown105.1avenue.com

new topic     » goto parent     » topic index » view message » categorize

Search



Quick Links

User menu

Not signed in.

Misc Menu