Objective-C(に限りませんけど)では、条件を書く手段がいくつかある。一番よく使うのはおそらくif文。例えば
int a = 10;
if(a < 10) {
NSLog(@"a is small");
} else {
NSLog(@"a is big");| export XMODIFIERS="@im=ibus" | |
| export XIM=ibus | |
| export XIM_PROGRAM=/usr/bin/ibus-daemon | |
| export XIM_ARGS="--xim" | |
| export GTK_IM_MODULE="ibus" | |
| export QT_IM_MODULE="ibus" | |
| ibus-daemon --xim -d |
| -> % echo 3 | _ tee /proc/sys/vm/drop_caches | |
| 3 | |
| -> % cat /proc/meminfo | grep -i memfree | |
| MemFree: 5603952 kB | |
| -> % time diff -crBNp linux-source-2.6.32 linux-source-2.6.32-prolog-scache-check > k06+ccheck+reset.patch | |
| diff -crBNp linux-source-2.6.32 linux-source-2.6.32-prolog-scache-check > 1.51s user 2.93s system 21% cpu 20.849 total | |
| -> % cat /proc/meminfo | grep -i memfree |
| #include <stdio.h> | |
| #include <stdlib.h> | |
| typedef union { | |
| int i; | |
| double d; | |
| } int_or_double; | |
| typedef enum { | |
| INT, |
| #include <iostream> | |
| //namespace protocol { | |
| //namespace type { | |
| struct event { | |
| enum event_enum { | |
| key_press = 0x00000001, | |
| key_release = 0x00000002, | |
| button_press = 0x00000004, | |
| // many others |
| NameVirtualHost *:80 | |
| <VirtualHost *:80> | |
| <Directory "E:/Documents/blog"> | |
| Require all granted | |
| </Directory> | |
| DocumentRoot "E:/Documents/blog" | |
| ServerName localhost | |
| DirectoryIndex index.html | |
| ErrorLog "logs/localhost-error.log" |
| object Foo { | |
| implicit def foo(): Unit = println("foo") | |
| def bar(implicit f: () => Unit) = f() | |
| } | |
| object Main { | |
| def main(args: Array[String]): Unit = { | |
| Foo.bar | |
| } |
| function Foo() {} | |
| Foo.myStaticMethod = function() { | |
| console.log("what a cool method!"); | |
| }; | |
| Foo.myStaticMethod(); |
| #include <stdio.h> | |
| int main(void) | |
| { | |
| int a, i = 2; | |
| printf("enter num: "); | |
| scanf("%d", &a); | |
| printf("%d = ", a); | |
| while(a > 1) { | |
| int n = 0; |
| // wrong | |
| switch(foo) { | |
| case 1: | |
| NSString* bar = @"foobar"; // expected expression | |
| // use bar | |
| } | |
| // compiles | |
| switch(foo) { | |
| case 1: { |