He asked about why it was named as C++, then I showed him a Java typical loop which is based C where we increment a counter.
int c = 0; while (c <= 10) { System.out.println(c); c++; }
He asked how the loop will be done in Scala. I started w/ a for comprehension, as he is familiar w/ loops on Scratch and Kojo.
for (c <- 0 to 10) { println(c) }Then he asked me about the for, <-, etc.
I then changed the code into
0 to 10 foreach printlnHis reaction "that is so awesome it's like english!"
No comments:
Post a Comment