0

What is method pls

In this lesson they give the definition of argument they say it's value assigned to a function or a method

9th Jul 2019, 8:37 PM
Tim
8 Respostas
+ 1
Class is a description of an object. So very simple: Object is a "thing" in memory that has state and behaviour. For example an object is a light bulb that has state to produce light or not and methods turn on and turn off 😉👌 I think it's more than clear now
9th Jul 2019, 10:31 PM
Dejan FrancuzđŸ„‡
Dejan FrancuzđŸ„‡ - avatar
+ 1
Yes Dejan it's clear what is class now.
9th Jul 2019, 10:35 PM
Tim
0
A method is a sub-routine that is internal to a class. It performs an action, they’re very useful for cleaning up your code, but more importantly they allow you to use a single block of code numerous times without having to re-type the code multiple times, especially if you need to execute that block of code with different values. Passing an argument into a method or functions parameter allows you to pass data into it so it can perform an action based on the value you pass through. For example: the print() function in python: The paranthesis are the parameters, and the result is dependent on the argument you pass into the parameters, so if you type print(‘hello’) the result would be a console output of “hello” where as if you passed in print(‘spam’) the result would be “spam” now for example say we declare a method named add_one and we assign an argument named ‘num’, so it will look like this: add_one(num) and now we give it some code, we want it to add one to whatever number we pass into the argument: def add_one(num): return num+1 “num” is the variable assigned to the method, it is a essentially a placeholder, any number we pass into the argument will take the place of “num” So now we can use this method throughout our entire class with any given number we so desire: x = add_one(5) y = add_one(x) result: x = (5+1) = 6 y = (6+1) = 7
9th Jul 2019, 9:54 PM
Jake
Jake - avatar
0
Simply said, method shows what one class does 😉👌
9th Jul 2019, 10:12 PM
Dejan FrancuzđŸ„‡
Dejan FrancuzđŸ„‡ - avatar
0
What is class then 😏.. looks like my questions will never end I'll check by myself too for what are classes
9th Jul 2019, 10:28 PM
Tim
9th Jul 2019, 10:31 PM
Tim
11th Jul 2019, 10:32 AM
Tim
0
Creo que lo.complicado no es la sintaxis si no las sentencias ya que al menos a mi en español me confunden
6th Nov 2019, 3:09 PM
Arland Curi
Arland Curi - avatar