Issue
I am trying to modify the VGA buffer's character. I don't understand the meaning of =>
:
b'\n' => self.new_line()
Solution
The context matters. I imagine this is probably from the middle of a match statement like this:
match foo {
b'\n' => self.new_line(),
// If foo is any other byte, do nothing (empty code block).
_ => {}
}
In this case, b'\n' => self.new_line()
roughly means "If the thing I am trying to match is the byte for a new line, call self.new_line()
".
match a {
// If a matches b do c, otherwise try next case
b => c,
// etc.
}
In C this would probably look a bit more like this:
switch (foo) {
case '\n':
new_line(self);
break;
// etc.
}
Answered By - Locke Answer Checked By - Senaida (PHPFixing Volunteer)
0 Comments:
Post a Comment
Note: Only a member of this blog may post a comment.