Return to Video

04-54 Precedence

  • 0:00 - 0:03
    So by this point, we've totally conquered Ambiguity, right?
  • 0:03 - 0:05
    Ah--not so right.
  • 0:05 - 0:07
    Even if I know whether an operation
  • 0:07 - 0:09
    is Left or Right Associative,
  • 0:09 - 0:14
    I'm still not sure, when there are multiple operations, which one to do first.
  • 0:14 - 0:16
    I could do the Multiplication first,
  • 0:16 - 0:18
    and get: 8 + 6 is 14
  • 0:18 - 0:21
    or I could do the Addition first,
  • 0:21 - 0:25
    and get: 2 * 10 is 20.
  • 0:25 - 0:27
    This isn't the same problem as associativity
  • 0:27 - 0:30
    because it's not about whether we're associating to the Left or the Right,
  • 0:30 - 0:33
    it's about the--sort of the precedence of these Operators.
  • 0:33 - 0:35
    which one is more important,
  • 0:35 - 0:37
    which one should I deal with first--
  • 0:37 - 0:39
    which one binds more tightly.
  • 0:39 - 0:42
    In Standard mathematics, we'd want to do the multiplication first.
  • 0:42 - 0:45
    Multiplication has higher precedence than Addition.
  • 0:45 -
    It gets serviced first.
Title:
04-54 Precedence
Description:

dummy description

more » « less
Video Language:
English
Team:
Udacity
Project:
CS262 - Programming Languages
Duration:
0:49
Amara Bot added a translation

English subtitles

Revisions