3 ms·
To be fair, most of programming is not intuitive. i = 20 # ... some lines later (not modifying i) for i in range(10): # non-intuitive for many - range go
by Jtsummers 4y ago
To be fair, most of programming is not intuitive.
i = 20
# ... some lines later (not modifying i)
for i in range(10): # non-intuitive for many - range goes from 0 to 9
print(i)
# ... some lines later (not modifying i)
print(i) # what value should be printed here?
Or a subtle (and hard to spot when not isolated like this) one character difference creating a behavior change:
i := 20
for i := 0; i < 10; i++ {
fmt.Println(i)
}
fmt.Println(i)
i := 20
for i = 0; i < 10; i++ {
fmt.Println(i)
}
fmt.Println(i)
And that's with a primitive part of programming. There is no language whose behavior can be fully intuited by all people, beginner or not. Some things will have to be taught or read through documentation and examples.