Navigation

    Fuze Arena Logo
    • Register
    • Login
    • Search
    • Categories
    • Recent
    • Popular
    • Users
    • Groups
    • Help
    • Discord

    Tutorial Says to do a line of code. Code editor says it's an error. What should i do?

    Beginners
    5
    6
    413
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • T
      tigerboy3050 F last edited by

      Hi i am currently doing Tutorial 2 (https://fuzearena.com/help/view/Variables)
      It says to do this code

       1. sweets = 3
        2. while sweets > 0 loop
        3.     clear( black )
        4.     print( "I have ",sweets," sweets in my bag." )
        5.     print( "If I eat one... then... " )
        6.     sweets -= 1
        7.     update()     
        8.     sleep( 1 )
        9. repeat
       10. print( "I have no sweets left... Oh no." )
       11. update()
       12. sleep( 2 )
      
      

      But when I run it...
      It says

      ---Error---
      
      LINE:             2
      FUNCTION:  N/A
      
      
      -------------
      
      Operation not recognized.
      (Details: string, greater than, int)
      

      I Went through it and it was the exact same code i saw in the tutorial.
      What is wrong???
      Confused
      Tigerboy

      1 Reply Last reply Reply Quote 0
      • vinicity
        vinicity F last edited by

        The code looks correct to me. Fuze seems to think that the sweets variable is a string? That seems strange. Are you using it somewhere else as well?

        1 Reply Last reply Reply Quote 0
        • JMM161437
          JMM161437 F last edited by JMM161437

          I would try putting the variable 'Int' before sweets. like this:

          int sweets = 3
          
          1 Reply Last reply Reply Quote 0
          • SteveZX81
            SteveZX81 F last edited by

            I copied your code in and it ran fine for me, maybe you have a typo?

            1 Reply Last reply Reply Quote 0
            • PB____
              PB____ last edited by PB____

              Maybe you still have sweets = "Delicious" from the previous example in your code? Or it could be that you only replaced the value between the quotes sweets = "3" in stead?
              If you put quotes around the value, it becomes a string (text), so you would need to remove the quotes around the number so sweets = "3" becomes sweets = 3.

              Fuze does not allow to check if a string (text) is less than a number (Fuze wouldn't know what to do with "Delicious" > 0 or "3" > 0, but it does know what to do with 3 > 0).
              Hope that helps :)

              1 Reply Last reply Reply Quote 4
              • T
                tigerboy3050 F last edited by

                I think it might have been a bug. Because it was the exact same code as the tutorial. So then i copied the code from the tutorial and it was exactly the same but it worked. Not sure why???

                1 Reply Last reply Reply Quote 0
                • First post
                  Last post