|
| 1 | +// armm77 ver. 0.1 |
| 2 | + |
| 3 | +// - Crea un comentario en el código y coloca la URL del sitio web oficial del |
| 4 | +// lenguaje de programación que has seleccionado. |
| 5 | + |
| 6 | +// Documentacion oficial Apple |
| 7 | +// https://developer.apple.com/library/archive/documentation/Cocoa/Conceptual/ObjectiveC/Introduction/introObjectiveC.html |
| 8 | + |
| 9 | +// Documentacion Alternativa GNUStep |
| 10 | +// https://gnustep.github.io/developers/documentation.html |
| 11 | + |
| 12 | +// - Representa las diferentes sintaxis que existen de crear comentarios |
| 13 | +// en el lenguaje (en una línea, varias...). |
| 14 | + |
| 15 | +// 1. Comentario de una sola linea, se utiliza. |
| 16 | +/* |
| 17 | + 2. Comentario de varias lineas, |
| 18 | + seccion de codigo o documentacion. |
| 19 | + */ |
| 20 | + |
| 21 | +// - Imprime por terminal el texto: "¡Hola, [y el nombre de tu lenguaje]!" |
| 22 | + |
| 23 | +#import <Foundation/Foundation.h> |
| 24 | + |
| 25 | +int main(int argc, const char * argv[]) { |
| 26 | + |
| 27 | +// - Crea una variable (y una constante si el lenguaje lo soporta). |
| 28 | + int weight = 0; // Variable |
| 29 | + const int LENGTH = 10; // Constante |
| 30 | + const char NEWLINE = '\n'; // Constante |
| 31 | + const float PI = 3.1415926535; // Constante |
| 32 | + const double WIDTH = 47.120577; // Constante |
| 33 | + |
| 34 | +/* |
| 35 | + - Crea variables representando todos los tipos de datos primitivos |
| 36 | + del lenguaje (cadenas de texto, enteros, booleanos...). |
| 37 | + |
| 38 | + Al ser Objective-C una variantes del lenguaje C con clases al estilo de |
| 39 | + Smalltalk, hereda los tipos de datos del mismo C. |
| 40 | +*/ |
| 41 | + int i = 1; // valor entero |
| 42 | + char c = 'c'; // valor caracter |
| 43 | + float f = 1.11111111; // valor decimal |
| 44 | + double d = 12.2222222; // valor decimal |
| 45 | + BOOL Y = YES; // valor boleano |
| 46 | + BOOL N = NO; // valor boleano |
| 47 | + |
| 48 | + @autoreleasepool { |
| 49 | + NSLog(@"Hola, Mundo!"); |
| 50 | + NSLog(@"Variable: %d", weight); |
| 51 | + NSLog(@"Valores costantes: %d, %f, %f",LENGTH,PI,WIDTH); |
| 52 | + NSLog(@"Salto de linea %c",NEWLINE); |
| 53 | + printf("Valor entero: %d \n", i); |
| 54 | + printf("Valor caracter: %c \n", c); |
| 55 | + printf("Valor decimal: %f \n", f); |
| 56 | + printf("Valor decimal: %f \n", d); |
| 57 | + NSLog(@"Valor boleano: %d", Y); |
| 58 | + NSLog(@"Valor boleano: %d", N); |
| 59 | + } |
| 60 | + return 0; |
| 61 | +} |
0 commit comments