Hi
So I bought the course after watching some videos on youtube, and Yes i am learning and following along but just somethings annoying me, such as would be nice to know what some of the terms mean an do,
First challenge we learn about INT then we have to work out how to move one INT to another and in your solution you type Temp, how would we know that if we have not covered it??
Would be good to have challenges on things that have been covered and just further explanation as to what certain things mean, other than that course is good so far
Hi Liam.
Welcome in here.
Let me start with an anecdote. Once I got a cover letter review by someone. I was told I make too long sentences. This is how I feel about your message.
I am also not sure to understand your point.
First paragraph. What do you mean by terms? Do you mean statements such as for
, if
, while
? Or maybe more general terms such as class, interface, inheritance?
Second paragraph. I seem to understand you are working with primitive types such as int
. You seem to be copying one int
to another int
. It seems you name one identifier temp but I do not comprehend the rest.
Could you please clarify?
As for challenges, this is a very good idea. Actually there are several sites that allow you to practice any language. The first that come in mind are CodinGame and Code Wars. The 1st one has a fancy interactive interface but I don’t like it much. The other one has no fancy interface but I prefer it by far.
Regards.
Terms - ie, What does INT mean, What does STD mean, Whats a string etc etc for a complete new-by would be nice to understand this as part of the course
Part 2 of my question - In the course we learn about variables and then are asked to solve a problem of putting apples into oranges and oranges into apples, The solution is to then use a new form of INT called Temp, But how would a new-by know to use temp when that was not explained in the course.
So for part two I am stating its like learning to drive a car being shown what a clutch is then being asked how to drive the car, so your thinking in terms of right we just learned about the clutch what it does and then being told the answer is actually to do with the accelerator, something totally new that you have not been shown yet.
I am not asking for any help, simply providing feedback from a new-by point of view which could make the course a better understanding
An int
is one of the primitive data types supported by nearly all programming languages. It is short for “integer” which is a math term effectively meaning whole numbers like 1, 63, -23, etc.
When Mosh uses temp
that is just a variable name. I do not recall if Mosh really gave an extensive overview of exactly how variables work but the short version is a variable has a type, a name, and a value it is assigned. The types should be either primitive types like int
and bool
(short for “boolean” meaning true and false values). The names can be any string of characters which is not a reserved keyword (along with some other naming rules like you cannot have spaces in the variable name). The value has to be something that matches the type (so you cannot assign true
to an int
variable and you cannot assign 45
to a bool
variable).
So let us examine the swap operation:
int x = 1;
int y = 2;
First we initialize two int
variables x
and y
which are assigned to the values 1 and 2 respectively.
Now we use a third variable to accomplish the swap:
int temp = x;
x = y;
y = temp;
We initialize a new int
variable called temp
with the value currently assigned to the x
variable (so 1), then we reassign x
to the value currently assigned to y
(so 2), finally we reassign y
to the value currently assigned to temp
(so 1). The end result is that x
is now 2 and y
is now 1 (the values have swapped).
3 Likes
Thank you for taking time to explain
I am really enjoying my learning so far