Any folk here who know computing stuff?

cinnamonrolls1

IB Expert
Messages
1,154
Reaction score
22
Gender
Female
Religion
Islam
Salams all, im revising for a coursework thing in computing that counts for 30% of my final grade and i have to do by myself in class under test conditions with basically no help. I was wondering if someone could basically explain to me what it means to declare a variable in programming? I dont really get what the point of the declaration is apart from it basically identifying that a variable is gonna come next. Also does anyone here have any knowledge of visual basic( version 6.0)?
Sorry for the long questions!
Thank you, jazakallah khairan
 
Salams all, im revising for a coursework thing in computing that counts for 30% of my final grade and i have to do by myself in class under test conditions with basically no help. I was wondering if someone could basically explain to me what it means to declare a variable in programming? I dont really get what the point of the declaration is apart from it basically identifying that a variable is gonna come next. Also does anyone here have any knowledge of visual basic( version 6.0)?
Sorry for the long questions!
Thank you, jazakallah khairan
Also( sorry!) what is an array like how does it work?
 
wa'alaikum as'salaam

VB is so old school, who teaches that anymore? even in HS these days, students are taught programming with java or some open source language.

Declaring a variable reserves a name and some space in memory for a variable of the specified type, but doesn't give it a value. Initializing gives the variable a value. Depending on how you're going to use the variable, you can declare it without initializing it and then initialize it later, or declare and initialize at the same time.

For example:

// declares integer variable
Dim num1 As Integer


// initializes integer variable that's already been declared
num1 = 6;

// declares and initializes integer variable at the same time
Dim num1 As Integer = 5;


Stack over flow is a great resource for programing questions.

https://stackoverflow.com/



An array is a list of items, a bit like a shopping list. It allows you to store more than one item in only one variable.Think of it like this. When writing your shopping list, you could use a separate piece of paper for each item you need to buy (a variable). However this is silly and unneeded—could you imagine how hard it would be to carry all that paper around with you? So, you use one piece of paper for all of your items. This one piece of paper is your array.

Youtube is a good resource also for tutorials on this stuff.

here's a video on arrays: https://www.youtube.com/watch?v=gKiNGZMuqI0
 
Like the brother said, stackoverflow is the best website if you need help with debugging.

Here is an example of an array of a program I was working on, just today:

float[] weekYAxisCoordinates = {0.85f, 0.6875f, 0.525f, 0.3625f, 0.20f};

This is in Java btw, anyway. The reason why you would want to use an Array, is because it is easy to manipulate. Example (simplified):

for(int i = 0; i < weekYAxisCoordinates.length; i++) {
Log.d(weekYAxisCoordinates)

}


So, what this does is simply print/log the values you see in the array. This would be impossible if you had put them all in seperate variables.


Edit:
It is also important to know what your goal is. There are different languages for different platforms.

Website: HTML, CSS, JavaScript, PHP, MySQL
Android: Java (though Java can be used almost on any device)
etc. etc.
 
Last edited:
Sorry for the late reply, i just saw yall had replied now but thank you all so much!! Yeah im not a VB fan but my school uses it( idk why tbh, id prefer Javascript or python) thank you all again!
 
AsSalamu 'Alaykum
I was wondering if someone could basically explain to me what it means to declare a variable in programming? I dont really get what the point of the declaration is apart from it basically identifying that a variable is gonna come next.
Declaring a variable is like dedicating a space in memory where you can store a value.You might be able to recognize variables,but computers don't.So you must declare them.
More: The Memory game-Intro to variables in Java (vid)
Also( sorry!) what is an array like how does it work?
Collection/group of similar type of data elements.Often used instead of declaring multiple variables often useful while using loops.
More: Arrays in C++
id prefer Javascript or python
JavaScript: Video Lessons , Practice
Python: Video Lessons , Practice

Udacity and Codecademy are very good sites to learn programming(Basics).
Also, StackOverflow is a forum(QA Site) for programmers.(But I warn you that their rules are annoying).

Hope it helps.
 
AsSalamu 'Alaykum

Declaring a variable is like dedicating a space in memory where you can store a value.You might be able to recognize variables,but computers don't.So you must declare them.
More: The Memory game-Intro to variables in Java (vid)

Collection/group of similar type of data elements.Often used instead of declaring multiple variables often useful while using loops.
More: Arrays in C++

JavaScript: Video Lessons , Practice
Python: Video Lessons , Practice

Udacity and Codecademy are very good sites to learn programming(Basics).
Also, StackOverflow is a forum(QA Site) for programmers.(But I warn you that their rules are annoying).

Hope it helps.
Thank you! Jazakhallah khairan
 

Similar Threads

Back
Top