QBasic Tutorial 15 - Arrays - QB64

Поділитися
Вставка
  • Опубліковано 18 гру 2024
  • www.SchoolFreew...
    Arrays hold lists of variables of the same data type. When there are large lists of variables and data, it is easier to contain the data in an array than have large amounts of separate variables to hold the data. Think of an array as a placeholder for piece of data.
    The syntax of the array is:
    DIM array_name(number_of_items) AS datatype

КОМЕНТАРІ • 52

  • @01.anarghanandivic21
    @01.anarghanandivic21 3 роки тому +3

    The name of the array, FNames is marked as Invalid Identifier. I am using QB45 in Windows 8 free version with 4gb Ram and without DosBox installed. Pls help

    • @SchoolFreeware
      @SchoolFreeware  3 роки тому +1

      I am not sure what the problem is. The code is available for download at SchoolFreeware.com. Check that code with what you have, for typos.

    • @01.anarghanandivic21
      @01.anarghanandivic21 3 роки тому +1

      @@SchoolFreeware It simply doesnt work and invalid identifier is shown. I have rechecked the code.

    • @SchoolFreeware
      @SchoolFreeware  3 роки тому

      Hello, I have installed QuickBasic 4.5 in DosBox and tried this out. FNames seems to be a reserved word in 4.5. This is not the case with QBasic 1.1 and QB64. Change FNames to something else like FirstNames.
      DIM FirstNames(5) AS STRING
      DIM x AS INTEGER
      CLS
      FirstNames(1) = "Joe"
      FirstNames(2) = "Jim"
      FirstNames(3) = "Jill"
      FirstNames(4) = "Joan"
      FirstNames(5) = "Jan"
      FOR x = 1 TO 5
      PRINT FirstNames(x)
      NEXT x

  • @John01dav
    @John01dav 12 років тому +2

    Yes the amount of the items you can have in your array depends on the data type and the amount of free memory (ram).

  • @falseprophetproductions5446
    @falseprophetproductions5446 9 років тому +2

    Thanks I was wondering how arrays worked since I was confused how the variables worked and the dim

  • @TacoTormentor
    @TacoTormentor 12 років тому +2

    Hah... year old comment. Ah well, still a problem for me. If I last recall, I could only have 10 items in an array. Then it'd start giving me errors and such. Do you know how to increase the amount an array can hold, if it's possible?

  • @zacharyschwanke7080
    @zacharyschwanke7080 7 років тому +2

    does any one know how to setup boundaries qb64? im trying to setup a maze game. and i what i want it to is where if the character hits the line it sends you back to the start of the game does any know how to do that?

  • @scorpion5710
    @scorpion5710 3 роки тому

    I'm a computer nerd and i have watched this vis 10 times .
    unlike other tutorials i forget all of these in a week...........
    *Sadness*
    _cries_

  • @TacoTormentor
    @TacoTormentor 13 років тому +4

    Is there a limit to how many items you can have?

    • @km006
      @km006 3 роки тому +1

      That's a really old comment. It depends on the version you've got and is it 64 bit? The newer 64 bit version can handle up to 9 quintillion elements. While the 32 bit version can handle around 2 billion. There's also pretty much the difference between 64 bit and 32 bit explained lol

  • @dhojthapa3852
    @dhojthapa3852 4 роки тому +1

    Isn't there n(0) in array n(5) ? That make 6 isn't it?

  • @paulfunigga
    @paulfunigga 12 років тому +3

    @SchoolFreeware why did we need to zeroize the counter and the guess?

    • @banimalhalder723
      @banimalhalder723 3 роки тому

      The "Sum" variable needs a blank canvas so that the Num(1) can be in the sum after one loop

  • @ihatesnakue6580
    @ihatesnakue6580 4 роки тому +3

    Ok sir Thankx👍

  • @sabitashaw4440
    @sabitashaw4440 7 років тому +1

    Thanks that was a big help for my exams

  • @patrioticboy6746
    @patrioticboy6746 8 років тому +4

    thank you sir. this helped me a lot

  • @divyarajparia3296
    @divyarajparia3296 7 років тому +1

    Sir I am in grade 7. In school We do not use DIM but use REM in the beginning. Arrays do not work without DIM. I do not understand. Please help me out with this.

    • @shaleenbaral7176
      @shaleenbaral7176 7 років тому +1

      REM is used for commenting ffs

    • @divyarajparia4961
      @divyarajparia4961 7 років тому

      Divya Rajparia ohh thanks

    • @PrismAnimates
      @PrismAnimates 7 років тому

      I am in Grade 8, but I haven't read Arrays in QBasic in last year, and also DIM is not compulsary, it declares what variable is what (for eg. X is string), Rem is used for giving comments, they are both very different topics

    • @shaleenbaral7176
      @shaleenbaral7176 7 років тому

      DIM is better imho

    • @divyarajparia4961
      @divyarajparia4961 7 років тому

      oh thankss.

  • @plasmaguy5
    @plasmaguy5 5 років тому +3

    Good stuff

  • @pmcuber2626
    @pmcuber2626 6 років тому +1

    what if user must enter a nubmer of arrays?

    • @PrismAnimates
      @PrismAnimates 5 років тому +1

      DIM a(10) 'For example
      CLS
      FOR i = 1 to 10
      INPUT "Enter a number and press enter"; a(i)
      NEXT i
      FOR i = 1 to 10
      PRINT a(i)
      NEXT i
      END
      'DONE!!

  • @greenleafspit8575
    @greenleafspit8575 5 років тому +1

    HEY! Can anybody help me with using read-data statement with arrays?

    • @SchoolFreeware
      @SchoolFreeware  5 років тому +1

      Tutorial 18 has read data with a 2D array.

  • @matts7975
    @matts7975 3 роки тому +2

    Nice and concise

  • @AshishKumar-xx8wu
    @AshishKumar-xx8wu 6 років тому +2

    Nice one

  • @michaeltopasna1777
    @michaeltopasna1777 6 років тому +2

    Geez I feel bad for the keyboard

    • @scorpion5710
      @scorpion5710 3 роки тому

      This is nothing watch tutorial 50 and you'll see

  • @ArtoriasSif
    @ArtoriasSif 9 років тому +3

    Thanks alot man

  • @KingPing1
    @KingPing1 8 років тому

    execpt on the qb64 website

  • @Leonaldo_Edits
    @Leonaldo_Edits Рік тому

    This is not working

  • @KingPing1
    @KingPing1 8 років тому +1

    the internet won't tell me what dim means!

    • @PrismAnimates
      @PrismAnimates 7 років тому

      Dim means declaring a type of variable
      for eg:
      If I want to declare name as string then I have to do:
      DIM name AS STRING
      Otherwise Qbasic will read it as a numeric variable, I hope this helps

    • @BinaryReader
      @BinaryReader 7 років тому +1

      it means dimension, notable for specifying arrays and their rank. Its an odd keyword for sure.

    • @reenaverma9565
      @reenaverma9565 6 років тому

      It means dimensions

  • @sse9070
    @sse9070 4 роки тому +1

    damn anyone in 2020 here

  • @anidude98
    @anidude98 13 років тому +1

    comment

  • @david_m157
    @david_m157 7 років тому

    Doesn't work. The new version of qbasic doesnt need quotations and i get a syntax error. Why do schools still use this crap? The dinosaur professors need to get with python.

    • @zunainfaisal
      @zunainfaisal 7 років тому

      David M Honestly, which grade are you in? The last time I studied QB64 was in Highschool. It's the most basic programming language so, it's compulsory to be taught. You cannot start running if you don't know how to walk. Many C languages like C Sharp are mostly similar. Python isn't that much of a difficult language either.

    • @miniyellow6909
      @miniyellow6909 3 роки тому

      I am in 6th class but my teacher tells in the old version

  • @anidude98
    @anidude98 13 років тому

    second

  • @sabitashaw4440
    @sabitashaw4440 7 років тому +1

    Thanks that was a big help for my exams

  • @sabitashaw4440
    @sabitashaw4440 7 років тому +3

    Thanks that was a big help for my exams