Calcious

Members
  • Content count

    31
  • Joined

  • Last visited

Community Reputation

137 Neutral

About Calcious

  • Rank
    Member
  1. What is a Thread of Execution? (C#)

    OK, I think I understand it all now, you guys have been a great help, thank you!
  2. What is a Thread of Execution? (C#)

    Alright, I think I'm starting to understand this. I'm just going to make sure that I truly know this. function(int X) { return X += X; } main() { int x = 5; function(x); } x doesn't get changed and the duplicate gets deleted after thread of execution ends unless I do this? x = function(x)
  3. What is a Thread of Execution? (C#)

    Huh, I just realized that I wasn't getting notifications at all. now that I'm thinking about it if an object gets dumped after leaving a function, then how do stuff like save games, etc work? Even if you copy the reference to the main method, it's all going to be dumped after you exit the program right? I may be getting too complex here but I just find it hard to go through any tutorial without knowing basically everything. Second question - When you were talking about primitive types and you said they were a value type, does it mean that a primitive is also a value type? Lastly, what do you mean by passing parameters and having the value type get copied? If my understanding of what "passing" means is correct then wouldn't that mean that I'm just using its value to evaluate something with that method? Why would I need to create a copy of it unless I was passing it to a method to create a second, altered version of it? If I just used it to get a return value for a new variable then I didn't modify the value type that I passed in at all, I just used it to get a result for something else so why would there be a copy? edit: I guess it wouldn't matter if a copy of the value type is made, garbage collection dumps the new value too, unless I store it in a new variable right? edit 2: Curiosity got the best of me and I decided to google value type, I ended up learning a very bare bones definition of what a deep copy is. When you said that the names are the value themselves, did you mean it like it was a deep copy? I may be reading what "deep copy" means wrongly but the names being the value themselves didn't sound "right" to me.
  4. What is a Thread of Execution? (C#)

    Thank you, that has helped me a lot, I got one last question though. It's about how these references can reference the same object but I haven't seen other data types do that, like if I do x = y, does it mean that x and y both reference the same thing or is there something different going on?
  5. So I was going through Microsoft Virtual Academy C# Fundamental by Bob Tabor and during a video, he said something about the thread of execution leaving the scope and reducing the reference count. What is a "thread of execution" and how can it leave the scope? I also don't understand how that reduces the reference count of an object, I mean "thread of execution" doesn't sound like something related to an instance of a class to me. The video is here for further information: https://mva.microsoft.com/en-US/training-courses/c-fundamentals-for-absolute-beginners-16169?l=ymM4awQIC_5206218949
  6. Console.writeline Not Printing Out Expression. C#

    Console.Read() was at the wrong location.
  7. Console.writeline Not Printing Out Expression. C#

    NVM FOUND THE ERROR.
  8. Console.writeline Not Printing Out Expression. C#

    No errors at all :|   Here's the full code.. using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace Variables_and_Operators { class Program { static void Main(string[] args) { //do not write decimals in byte or int. 20.0 is different from 20 in C#. Lol. byte userage = 20; int NumberOfEmployees = 210; //you can hold integral numbers with double, float and decimal despite them be using for decimals. double hip = 15; float slip = 30; decimal grip = 45; //you need to add f in the float variable after the number to turn it into a float and for the compiler to recognize it exactly as a float. You need to add m to turn decimal into decimal. double strom = 15.322; float group = 15.753f; decimal shopper = 99.12345m; //this is a char data type, when initializing char, use ' instead of ". char grade = 'A'; //this is a bool bool promote = true; //you can store multiple variable in the same line as long as they are the same type. byte bob = 50, stanley = 90; //you can initialize a variable on a different statement. byte year; year = 157; int x = 1, y = 2; x = y + x; // x <- y... Aka when x = y, the value of y goes to x. y stays the same, x changes to y. y = x; // y <- x... y still stays the same since x is 2 and y was already 2. Console.WriteLine(x); Console.WriteLine(y); Console.Read(); //as long as there is one non integer number in the equation, you will get a non integer value other wise it will be truncated. Console.WriteLine(7 / 2); Console.WriteLine(7.0 / 2); Console.WriteLine(7 / 2.0); Console.WriteLine(7.0 / 2.0); x++; //increases a value by 1 x--; //decreases a value by 1 //++ can be placed before a variable or after it, it affects the sequence in which tasks are performed. int counter = 1; Console.WriteLine(counter++); //prints the original value of counter and then it increments the value. As in it will print the original value but not the value++. Console.WriteLine(++counter); //increments the value then prints the new value. //converts 20.9 into an integer. x = (int)20.9; //Another way to declare a float or decimal without f or m. Remember that all numbers with decimals are treated as double first. float num1 = (float)20.999999999; decimal num2 = (decimal)20.53; } } } It's messy but ehhhhhhhhhhhhhhhhhh.
  9. Why does this code not work? Console.WriteLine(7/2) It doesn't print anything on the console.
  10. Kinda hard to explain this

    It feels like I'm learning a programming language, not learning programming itself. The book I'm reading teaches python (and is for absolute beginners). You would think that an absolute beginner would learn the concepts behind programming?
  11. Kinda hard to explain this

    LearnPython.org seems good but I don't know what some of the words are. I guess I can google those words.
  12. Kinda hard to explain this

    I think the python book that I'm using isn't really going in depth.    If you guys can recommend some books that has the right balance of complex and (intuition???), it would be great!
  13. Kinda hard to explain this

    subcores = ["AX43", "JOM10", "BALLS", "AYVOC", "PIZZA", "TITAN"] cores = ["Fast", "Strong", "Balanced"] Whole_Item = [] active = 1 add_item_active = 1 item_select = [] core_prompt = ("Select one of them, spell them exactly like it is spelled like." + "\n") subcores_prompt = ("Select one of the core, spell them exactly like it is spelled like." + "\n") add_item = "" ##################### print("trash code below!\nThese are the cores available for you:") for Cheese in cores: print("\t" + Cheese) cheese_select = input(core_prompt) if cheese_select in cores: print("Adding in " + cheese_select.title() + ".") else: print("This isn't in the list, sorry.") active = 0 if active == 1: print("Now for the Sub Cores:") for Item in subcores: print("\t" + Item) item_holder = input(subcores_prompt) if item_holder in subcores: item_select.append(item_holder) else: print("This isn't an item, sorry.") active = 0 if add_item_active == 1: add_item = input("Would you like to add more items? If so, enter Yes. \n") while add_item == "Yes" or "yes": add_item_active = 0 extra = input("Please select another sub core.\n") if extra in subcores: print(extra + " has been added!") item_select.append(extra) #checks again... if add_item is no or No, go to the if statement below. If Yes or yes, while loop still goes on add_item = input("Would you like to continue adding more items?.\n") if add_item == "No" or "no": print("This is your finalized core thingy:") item_select.append(cheese_select) Whole_Item = item_select[:] for whole in Whole_Item: print("\t" + whole) So I had to do a project for a python book and I made this. The last comment above should tie in with my current problem.   Even if I type in No or No, the while loop still goes on even though it should stop since it requires add_item to be "Yes" or "yes".    (also, do if statements only run once?)
  14. I don't see how that is aggressive. I thought aggressive would involve cursing at the user for using tabs and telling them how horrible tabs are and that they should die for using it.   It sounds more like they are joking than telling you to f*** off.   edit: #fixed some words #added in edit:
  15. Another question.    Look at this code below.. Question is in that comment! if active == 1: print("Now for the items:") for Item in Items: print("\t" + Item) item_holder = input(items_prompt) if item_holder in Items: item_select.append(item_holder) else: print("This isn't an item, sorry.") #Even if I change active to 0, add_item = input("Would you like to add more items? If so, enter Yes.\n") still executes! active = 0 add_item = input("Would you like to add more items? If so, enter Yes.\n")