renciso218 / blockly

Automatically exported from code.google.com/p/blockly
0 stars 0 forks source link

Lack of type conversion #29

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
What steps will reproduce the problem?
1. try to make a 'guess number' sample with issue 24 read/input block

the sample is :

number = 23
guess = int(raw_input('Enter an integer : '))
if guess == number:
    print 'Congratulations, you guessed it.' # New block starts here
    print '(but you do not win any prizes!)' # New block ends here
elif guess < number:
    print 'No, it is higher than that.' # Another block
    # You can do whatever you want in a block ...
else:
    print 'No, it is lower than that.'
    # you must have guess > number to reach this block
print 'Done'

What is the expected output? What do you see instead?

It works fine in javascript, but not for python output, since the generated 
python code lack of 'int' to do the type conversion.

one way is to provide additional TYPE info while get user input, thus we'll 
have one block.
another way is to provide a set of type conversion blocks, which might be break 
the 'no need to learn formats' rule.

Original issue reported on code.google.com by gasolin on 12 Jun 2012 at 12:21

GoogleCodeExporter commented 8 years ago
I would like a type selector for the input field. Then mobile browsers could 
open the correct input mask for different types of input. (number field for 
numbers, visual keyboard for text)
An other benefit would be automatic input checking.

Original comment by markus.k...@gmail.com on 15 Jun 2012 at 2:15

GoogleCodeExporter commented 8 years ago
It might be good to implement type conversion in every input blocks.

Thus this issue will be merged to Issue 24

Original comment by gasolin on 16 Jun 2012 at 8:06