/docs/MyDocs

To get this branch, use:
bzr branch http://darksoft.org/webbzr/docs/MyDocs

« back to all changes in this revision

Viewing changes to Development/languages/awk/awk.expr

  • Committer: Suren A. Chilingaryan
  • Date: 2009-04-09 03:21:08 UTC
  • Revision ID: csa@dside.dyndns.org-20090409032108-w4edamdh4adrgdu3
import

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
############################# Expresions ######################################
 
2
f = 5E+01                       # & etc
 
3
a = 2; b = 3; print (a b) + 4;  # Prints 27 (23+4)
 
4
a + b; a - b; - a ; + a ;       # Last for converting string to number
 
5
a * b; a / b; a % b             # ...
 
6
a ** b; a ^ b                   # "a" raised to the "b" power
 
7
a = b = c = 0;                  # You can do so
 
8
a += b; a++;                    # And so on
 
9
!=, ==, >, <, <=, >=            # String or Numeric Comparisons ( if 1 argument
 
10
                                # string used string comparision ( if unknown
 
11
                                # thinking that numeric ) )
 
12
                                # Numerics converted with help of "CONVFMT",
 
13
                                # to be compared with strings 
 
14
||, &&, !                       # ...
 
15
b in a                          # True if Array "a" have subscript "b"
 
16
                                # Example: 
 
17
                                #       foo[rand()] += 5 ;
 
18
                                #       for (x in foo ) print x, foo[x]
 
19
a[1, "a"]                       # Arrays, and so on ( Numeric values converted
 
20
                                # with "CONVFMT", BE WARE!)
 
21
                                # WARNING! a[1, "a"] ~ a[1"SUBSEP"a]
 
22
                                # "(b, c) in a" - works to, for example:
 
23
                                #       for ( x in foo ) {
 
24
                                #               split(x,separate,SUBSEP) ... }
 
25
delete a[1]                     # Delete element of array
 
26
                                #       Main Idea will not apear in "in"
 
27
delete a                        # Deletes all elements of array
 
28
 
 
29
a b                             # Concatenation
 
30
 
 
31
expr ? if_true... : if_false... # ...
 
32
 
 
33
############################# String Conversions ##############################
 
34
"2.5"   --> 2.5         "1e3"   --> 1000        "25fix" --> 25
 
35
"fix"   --> 0   ( and at all if begins not from number then --> 0 )
 
36
 
 
37
And at all in info files string/numeric selection is very misty...
 
 
b'\\ No newline at end of file'