A very simple doubt

37 views
Skip to first unread message

rahul....@gmail.com

unread,
Mar 17, 2020, 2:53:17 AM3/17/20
to Pencil Code
I tried running some basic programs (to prepare to teach my little niece some algorithmic thinking, without the hazels of programming syntax).
On trying the FOR loop, I bumped into this: “for i in [1...6]” gave me 1, 2, 3 and so on but up to only 5.
I had to rewrite it as “for i in [1...6+1]” in order to get 1, 2, 3 and so on up to 5. 
Is this a bug, or is it something I know not about PencilCode? 

Regards..

Pencil-loop.png



Message has been deleted

rahul....@gmail.com

unread,
Mar 19, 2020, 2:54:15 AM3/19/20
to Pencil Code
Aaah.. Got it: The three-dots vs two-dots. I'm too much a beginner with Pencil-Code (though have otherwise experience in programming, including JavaScript), that's why. Sorry...

rahul....@gmail.com

unread,
Apr 4, 2020, 7:08:12 AM4/4/20
to Pencil Code
I would rather suggest to the developers to add a “For x in” block with two dots (ie., inclusive of the upper limit). At present only one with three dots is available – I’ll then have to switch to text mode and manually delete one dot. 
I’m suggest this (only because it)/(so as to) additionally include a “For” block that is compatible to the approach of the BASIC language (be it QBasic, VB6 or VBScript).


Reply all
Reply to author
Forward
0 new messages