BecomeAnXcoder / Cтань X-кодером

→Objective-C has two other ways to repeat a set of statements:
0 У Обжект-С есть два пути повторить это утверждение:
→//[3]
float celsius, tempInFahrenheit;
for (tempInFahrenheit = 0; tempInFahrenheit <= 200; tempInFahrenheit = tempInFahrenheit + 20)
{
celsius = (tempInFahrenheit - 32.0) * 5.0 / 9.0;
NSLog(@"%10.2f -> %10.2f", tempInFahrenheit, celsius);
}
0 //[3]
float celsius, tempInFahrenheit;
for (tempInFahrenheit = 0; tempInFahrenheit <= 200; tempInFahrenheit = tempInFahrenheit + 20)
{
celsius = (tempInFahrenheit - 32.0) * 5.0 / 9.0;
NSLog(@"%10.2f -> %10.2f", tempInFahrenheit, celsius);
}
→do {} while ()
0 do {} while ()
→and
0 и
→while () { }
0 while () { }
→while()
0 while()
→0.00 -> -17.78
20.00 -> -6.67
40.00 -> 4.44
60.00 -> 15.56
80.00 -> 26.67
100.00 -> 37.78
120.00 -> 48.89
140.00 -> 60.00
160.00 -> 71.11
180.00 -> 82.22
200.00 -> 93.33
0 0.00 -> -17.78
20.00 -> -6.67
40.00 -> 4.44
60.00 -> 15.56
80.00 -> 26.67
100.00 -> 37.78
120.00 -> 48.89
140.00 -> 60.00
160.00 -> 71.11
180.00 -> 82.22
200.00 -> 93.33
→//[17]
int anInt;
//Some code that sets the value of anInt
if ((anInt % 2) == 0)
{
NSLog(@"anInt is even");
}
else
{
NSLog(@"anInt is odd");
}
0 //[17]
int anInt;
//Некоторый код который устанавливает значение anInt
if ((anInt % 2) == 0)
{
NSLog(@"anInt is even"); //Четный
}
else
{
NSLog(@"anInt is odd"); //Нечетный
}
→//[16]
int x = 13, y = 5, remainder;
remainder = x % y;
0 //[16]
int x = 13, y = 5, remainder;
remainder = x % y;
→A Boolean is a simple logical true or false value. 1 and 0 stand for true and false are often used interchangably, and can be considered equivalent:
True False
1 0
0 Булевой является простая логическая истинное или ложное значение. Состояние 1 и 0 для истины и лжи часто взаимозаменяемы, и могут считаться эквивалентными:
True False
1 0
→In the first case [14], the result is 2. Only in the second case [15], the result is what you'd probably expect: 2.4.
Booleans
0 В первом случае [14], результат 2. Только во втором случае [15], результат такой, который вы и ожидали 2.4.
Логический (boolean)
→//[15]
float x = 5, y = 12, ratio;
ratio = y / x;
0 //[15]
float x = 5, y = 12, ratio;
ratio = y / x;
→//[14]
int x = 5, y = 12, ratio;
ratio = y / x;
0 59 //[14]
int x = 5, y = 12, ratio;
ratio = y / x;
→//[13]
x = 10;
x++;
y = 2 * x;
0 //[13]
x = 10;
x++;
y = 2 * x;
→//[12]
x = 10;
y = 2 * (++x);
0 //[12]
x = 10;
y = 2 * (++x);
→//[11]
x = 10;
y = 2 * (x++);
0 //[11]
x = 10;
y = 2 * (x++);
→Using variables in calculation
0 Использование переменных в вычислении
→* Not recommended: Door8 (starts with capital)
0 * Не рекомендуется: Door8 (начинается с заглавной)
→* Not allowed: door 8 (contains a space)
* 8door (starts with digit)
0 * Запрещенные: door 8 (содержит пробел)
* 8door (начинается с цифры)
→* Good variable names: door8k
* do8or
* do_or
0 * Правильные имена переменных: door8k
* do8or
* do_or
Резюме
Пол:
мужчина
Родной язык:
русский
С нами:
с 27 августа 2009 г. (6261 день)
Не является членом клуба.
Деятельность:
28 версий перевода с общим рейтингом 0
Карма: 1 (оценок: 1)
Написать ShizaCat личное сообщение