Re: Wish List Again

new topic     » goto parent     » topic index » view thread      » older message » newer message

On Mon, 29 May 2000 13:24:18 +0700, Aku <aku4 at CROSSWINDS.NET> wrote:

>Ditulis 28-5-00, 10:59 pake kalong
>
>[1] For example,
>
>   sequence cmd, thirdParam
>
>   cmd=command_line()
>   thirdParam=cmd[3]
>
>  Why we cannot use:
>
>   sequence thirdParam
>
>   thirdParam=command_line()[3]
>
>  It's easier.


   Can not used because command_line() is a function that

   RETURNS a SEQUENCE. You can not index a FUNCTION.

>
>[2] A function may not return a value
>    (can be called as a procedure), eg:
>
>    function writePos(atom num)
>        if num >= 0 then
>           ? num         -- no return
>        else
>           return num
>        end if
>    end function
>
>    writePos( -5 )    -- no return value
>
>

  Must be procedure or function can not be both.

  If program calls writePos() how will program know if number is printed.

  Program can not see value printed. Good function would return zero if

  printed or num if not printed.

>[3] We can use undeclared variable, eg:
>
>    -- -- ### (no 'object var1, var2, var3' )
>
>    var1=1+2
>    var2=var1*2
>    var3=repeat(var2, 5)
>
>    -- var1,var2,var3 are automatically declared as
>    -- 'object' variable type
>
>
>
>I  can  use no: [2] and [3] in visual basic, makes programming easier,
>why not in euphoria?

  The only time that you can NOT do this if variable is OBJECT.

  Any other type of data you can use SEQUENCE

  ###( sequence var )
    var[1]=1+2
    var[2]=var[1]*2
    var[3]=repeat(var[2], 5)

>(sorry if my english is bad)


  Very good english

  Bernie

new topic     » goto parent     » topic index » view thread      » older message » newer message

Search



Quick Links

User menu

Not signed in.

Misc Menu