
-----------------------------------
lucklesslily
Thu Nov 05, 2015 11:11 am

Problems with user input
-----------------------------------
So I'm running into a couple problems with my program, it's calculating shipping time and cost using the weight and whether the package is international/domestic. Anyway, my problem is that I'm trying to error proof the weight input so that if someone puts in letters instead of numbers the program doesn't crash, but it's not really working...

put "And how much will your product be weighing? (In kg)" 
    loop %Weight Error Safe      
        get weightReply :*
        %Weight Word Error Safe
        if strrealok (weightReply)then
            weight := strreal (weightReply) 
            %Weight Number Error Safe 
        elsif weight 0) 
        end if 
    end loop

Furthermore, when you do put in a number, it doesn't continue with the rest of the program, it's just a bunch of blank space where you can enter more numbers.  :oops:

-----------------------------------
Insectoid
Thu Nov 05, 2015 2:05 pm

RE:Problems with user input
-----------------------------------
'variable not defined' means your variable has no value. You created the variable weight, but never assign it a number. But you have a line that says 'weight := strreal (weightReply)', so why does it still not have a value? Maybe there's a reason that line doesn't execute. Maybe it has something to do with your if statement structure.
