Re: {} Questions

Liste des GroupesRevenir à cl awk 
Sujet : Re: {} Questions
De : porkchop (at) *nospam* invalid.foo (Mike Sanders)
Groupes : comp.lang.awk
Date : 21. Aug 2024, 19:57:32
Autres entêtes
Organisation : A noiseless patient Spider
Message-ID : <va5das$3vg5l$1@dont-email.me>
References : 1 2 3 4
User-Agent : tin/2.6.2-20221225 ("Pittyvaich") (NetBSD/9.3 (amd64))
Janis Papanagnou <janis_papanagnou+ng@hotmail.com> wrote:

On 21.08.2024 13:48, Mike Sanders wrote:
 
 
[ Concerning the basic awk syntax:  condition { action }  ]
 
And yet there's still more implied nuance somehow. Let me try to articulate
my thoughts...
 
- These types of constructs are 'auto' ran per line of input (assuming
  its not located within another user-written function) that I get.
 
You cannot have these constructs with their given semantics inside a
function. You'd have to formulate them explicitly (in the imperative
form) with 'if', as in
 
  function f ()
  {
      if (condition) action
  }

Of course I tried & failed eariler today...

   function foo() {

      !boo { code }
   }
 
  Perhaps a potential efficiency hit to be aware of.
 
- There's also the scope of variables to consider... Because any
  variable's located outside of a user-written function or conversely
  located within a 'bare naked' construct is global, or at least
  exposed to the entire script's 'world', so I want be careful here...
 
All variables have global scope, with the exception of those specified
in a function argument list along with the real arguments, as in
 
  function f (arg1, arg2,   local1, local2)  { global = arg1 ; ... }
  f ("Hello", 42);
 
(There's some caveat with arrays in the function argument list.)
 
Janis

Not sure why that would be, can you offer more detail?

At any rate, as always thanks for the brainfood.

--
:wq
Mike Sanders


Date Sujet#  Auteur
21 Aug 24 * {} Questions9Mike Sanders
21 Aug 24 `* Re: {} Questions8Ben Bacarisse
21 Aug 24  `* Re: {} Questions7Mike Sanders
21 Aug 24   +* Re: {} Questions4Janis Papanagnou
21 Aug 24   i+- Re: {} Questions1Janis Papanagnou
21 Aug 24   i`* Re: {} Questions2Mike Sanders
22 Aug 24   i `- Re: {} Questions1Janis Papanagnou
21 Aug 24   `* Re: {} Questions2Ben Bacarisse
21 Aug 24    `- Re: {} Questions1Mike Sanders

Haut de la page

Les messages affichés proviennent d'usenet.

NewsPortal