a method is named and attached to an object. so, for example, a method is like a function but is contained inside a class. its scope is limited to that class, and cannot affect variables outside that class, even global variables. if you need to affect a variable outside of a class, just use a function (or routine) that is not contained in a class. 

a function is named and returns a value. 

a routine is like a function but does not need to return a value. 

a procedure is named and may or may not return a value, but receives parameters. 

i think the distinctions between a function and a routine are sort of old school. i don't think that distinction is important anymore. 

so a function is like 
function addOne(n) { 
  return n++; 


routine is like 
function doStuff(){ 
  makeStuffHappen(); 


and a method is like 
thing.destroy(){ 
  thing.destroyed = true; 


a procedure is like 
makeApples(x){ 
  makes x apples 


edit: typos and made bad examples>.<;

What is the difference between routine , method , procedure , function ? please explain it with example?的更多相关文章

  1. MySQL:procedure, function, cursor,handler

    Procedure & Function Procedure 语法: CREATE [DEFINER = { user | CURRENT_USER }] PROCEDURE sp_name ...

  2. scala之method和function的区别

    在我没有学习scala的时候,主要用java和python做日常工作开发,印象中,没有特别的刻意的去区分method和function的区别,这个关系,正如我们日常生活中,没有刻意的去区分质量和重量. ...

  3. SQL1042C running a fenced routine (stored procedure/UDF)

    Relation to this link http://www-01.ibm.com/support/docview.wss?uid=swg21399105 2015-01-11-13.38.19. ...

  4. oracle 备份数据库对象(存储过程PROCEDURE,FUNCTION,VIEW,TRIGGER...)

    开发过程中,需要不停的备份数据库对象, 特别是存储过程, 每次手动备份不免很低能啊 历经几次修改终于, 完美了,O(∩_∩)O哈哈~      (当然,你也可以再改简便一点~~~) select db ...

  5. 深入学习Java8 Lambda (default method, lambda, function reference, java.util.function 包)

    Java 8 Lambda .MethodReference.function包 多年前,学校讲述C#时,就已经知道有Lambda,也惊喜于它的方便,将函数式编程方式和面向对象式编程基于一身.此外在使 ...

  6. 存储过程和函数 PROCEDURE & FUNCTION

    SQL语句执行的时候,要首先编译,然后在被执行.在大型数据库系统中,为了提高效率,将为了完成特定功能的SQL语句集进行编译优化后,存储在数据库服务器中,用户通过指定存储过程的名字来调用执行. 具体而言 ...

  7. different between method and function

    A method is on an object. A function is independent of an object. For Java, there are only methods. ...

  8. Java细节----method和function的区别

    面向对象的语言叫方法 面向过程的语言叫函数 在java中没有函数这么一说,只有方法一说.属于概念上的区别. 硬要说区别. Method必须依赖于Object. Function 是独立的,不需要依赖于 ...

  9. 修改Mysql procedure,function and view definer

    1 一次性修改遇到错误 update mysql.proc set definer='root@%'; update mysql.proc set definer='root@%'; ERROR 10 ...

随机推荐

  1. python_excel

    1. xlrd, xlwt, xlutils的关系 Python中一般使用xlrd(excel read)来读取Excel文件,使用xlwt(excel write)来生成Excel文件(可以控制Ex ...

  2. 南非的5DT数据手套使用说明

    数据手套-5 Ultra/数据手套-14 Ultra 5DT 数据手套-Ultra数据手套的设计目的是为了满足现代动作捕捉和动画制作等专业人士的严格要求.它提供了舒适,易于使用,小型要素和多种应用的驱 ...

  3. PostgreSQL 磁盘使用大小监控

    表大小信息 postgres=# SELECT *, pg_size_pretty(total_bytes) AS totalpostgres-# , pg_size_pretty(index_byt ...

  4. PostgreSQL installations

    [root@test02 init.d]# ll /etc/init.d/postgresql-9.5 -rwxr-xr-x. 1 root root 10072 May 15 06:34 /etc/ ...

  5. poj 3254 Corn Fields

    http://poj.org/problem?id=3254 Corn Fields Time Limit: 2000MS   Memory Limit: 65536K Total Submissio ...

  6. UISegmentedControl 的使用

    /** 设置选择器 */ - (void)setUpSegmentCtr { UISegmentedControl *segmentCtr = [[UISegmentedControl alloc] ...

  7. ThroughRain第一次冲刺(每天更新)

    第一次冲刺时间: 11月14-11月23 第一次冲刺目标及分配: 1.注册登录界面            认领:王大华 2.界面跳转                  认领:梁仕标 3.点餐界面   ...

  8. SQLServer数据库监控代码

    SQLServer数据库监控代码: creation_time, total_worker_time, last_worker_time, max_worker_time, min_worker_ti ...

  9. C++11基于范围的for循环

    C++11包含一种新的 for 循环,称为基于范围的 for 循环,可以简化对数组元素的遍历.格式如下: for(Type VarName : Array){ //每个元素的值会依次赋给 VarNam ...

  10. World Wind .NET开发

    World  Wind  .NET开发