Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.soft-sys.math.maple > #834

Re: colon in loop

From "Nasser M. Abbasi" <nma@12000.org>
Newsgroups comp.soft-sys.math.maple
Subject Re: colon in loop
Date 2013-10-17 18:46 -0500
Organization Aioe.org NNTP Server
Message-ID <l3psrn$bbl$1@speranza.aioe.org> (permalink)
References <l3prpf$hdv$1@dont-email.me>

Show all headers | View raw


On 10/17/2013 6:27 PM, John Harper wrote:
> The following Maple program
>
>> for x from 1 to 2 do
>>      y := x^2:
>>      evalf(y^2);
>> od;
>
> gives this output:
>
>                                     y := 1
>
>                                       1.
>
>                                     y := 4
>
>                                       16.
>
> I had thought that the colon after y := x^2 would prevent printing y := 1
> and y := 4. What should I have done instead?
>

 From help on ":" (i.e. colon)

"
In an interactive Maple session, the result of the statement
will not be displayed if the statement is terminated with a colon.
"

"Note: This rule does not apply to statements enclosed in the
body of another statement such as an if statement, loop,
procedure, module, use statement, or try statement. In these
cases, all enclosed statements must be separated by a semicolon or colon
"

So, if you replace "do;"  with "do:" then you'll see that no
output at all. Even those that have ";" on them, inside the do.

So it looks like one needs so use "do:" and then use print
to display those values they want to see.

--Nasser

Back to comp.soft-sys.math.maple | Previous | NextPrevious in thread | Next in thread | Find similar


Thread

colon in loop John Harper <john.harper@vuw.ac.nz> - 2013-10-18 12:27 +1300
  Re: colon in loop "Nasser M. Abbasi" <nma@12000.org> - 2013-10-17 18:46 -0500
  Re: colon in loop Axel Vogt <&noreply@axelvogt.de> - 2013-10-18 11:45 +0200

csiph-web