You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
31 lines
1.0 KiB
Plaintext
31 lines
1.0 KiB
Plaintext
{\rtf1\ansi\ansicpg1252\cocoartf1671\cocoasubrtf600
|
|
{\fonttbl\f0\fmodern\fcharset0 Courier;\f1\fswiss\fcharset0 Helvetica;\f2\fmodern\fcharset0 Courier-Bold;
|
|
}
|
|
{\colortbl;\red255\green255\blue255;}
|
|
{\*\expandedcolortbl;;}
|
|
\margl1440\margr1440\vieww21320\viewh16320\viewkind0
|
|
\pard\tx720\tx1440\tx2160\tx2880\tx3600\tx4320\tx5040\tx5760\tx6480\tx7200\tx7920\tx8640\pardirnatural\partightenfactor0
|
|
|
|
\f0\fs28 \cf0 // CODE EXAMPLE\
|
|
// \'93int\'94 means \'93Integer\'94, which is another way of saying \'93whole number\'94\
|
|
// \'93*\'94 means to multiply. So \'933 * 2\'94 is the same as saying \'933 x 2\'94\
|
|
// In the example below, \'93KidsEatApples\'94 is a method (also called a function), and when it\'92s called in code, it will return an \'93int\'94.\
|
|
\
|
|
public int apples = 10;\
|
|
public int kids = 3;\
|
|
\
|
|
public int KidsEatApples(int applesPerKid)\{\
|
|
return applesLeft = apples - (kids * applesPerKid);\
|
|
\}
|
|
\f1 \
|
|
\
|
|
\
|
|
\
|
|
\
|
|
\
|
|
\
|
|
QUESTION:\
|
|
\
|
|
If I call the method
|
|
\f2\b KidsEatApples(1)
|
|
\f1\b0 what value will be returned?} |