mirror of
https://github.com/adambard/learnxinyminutes-docs.git
synced 2024-12-23 17:41:41 +00:00
Merge pull request #2909 from prertik/master
[awk/en] fix for Local Variable in "arithmetic_functions"
This commit is contained in:
commit
8612e00b9f
@ -38,7 +38,7 @@ BEGIN {
|
|||||||
a = count + 1
|
a = count + 1
|
||||||
b = count - 1
|
b = count - 1
|
||||||
c = count * 1
|
c = count * 1
|
||||||
d = count / 1
|
d = count / 1 # integer division
|
||||||
e = count % 1 # modulus
|
e = count % 1 # modulus
|
||||||
f = count ^ 1 # exponentiation
|
f = count ^ 1 # exponentiation
|
||||||
|
|
||||||
@ -143,7 +143,7 @@ BEGIN {
|
|||||||
}
|
}
|
||||||
|
|
||||||
# Here's how you define a function
|
# Here's how you define a function
|
||||||
function arithmetic_functions(a, b, c, localvar) {
|
function arithmetic_functions(a, b, c, d) {
|
||||||
|
|
||||||
# Probably the most annoying part of AWK is that there are no local
|
# Probably the most annoying part of AWK is that there are no local
|
||||||
# variables. Everything is global. For short scripts, this is fine, even
|
# variables. Everything is global. For short scripts, this is fine, even
|
||||||
|
Loading…
Reference in New Issue
Block a user