User:HiyaHiya/Codebox: Difference between revisions
Jump to navigation
Jump to search
No edit summary |
(js) |
||
Line 1: | Line 1: | ||
jThis is dawgdawgdawg's codebox. Experimenting with the really, really big selection of languages in the code block menu | |||
== ABAP == | |||
<syntaxhighlight lang="abap"> | |||
REPORT TEST. | REPORT TEST. | ||
WRITE 'Hello World'. | WRITE 'Hello World'. | ||
Line 10: | Line 13: | ||
ADD 5 TO 7. " This is addition in ABAP, or atleast i think. | ADD 5 TO 7. " This is addition in ABAP, or atleast i think. | ||
</syntaxhighlight> | |||
== js == | |||
<syntaxhighlight lang="js"> | |||
// this is javascript ^_^ | |||
// chatgpt really helped | |||
function isPrime(number) { | |||
if (number <= 1) { | |||
return false; | |||
} | |||
for (let i = 2; i * i <= number; i++) { | |||
if (number % i === 0) { | |||
return false; | |||
} | |||
} | |||
return true; | |||
} | |||
const num = 17; | |||
if (isPrime(num)) { | |||
console.log(num + " is a prime number."); | |||
} else { | |||
console.log(num + " is not a prime number."); | |||
} | |||
</syntaxhighlight> | |||
== js+cheetah == | |||
<syntaxhighlight lang="js+cheetah"> | |||
// Import the CheetahJS library | |||
import cheetah from 'cheetahjs'; | |||
// Define the ViewModel | |||
const viewModel = { | |||
firstName: 'John', | |||
lastName: 'Doe', | |||
fullName: function() { | |||
return this.firstName + " " + this.lastName; | |||
} | |||
}; | |||
// Bind the ViewModel to the HTML | |||
cheetah.bind(viewModel, document.getElementById('app')); | |||
</syntaxhighlight> | </syntaxhighlight> |
Revision as of 10:08, 1 October 2023
jThis is dawgdawgdawg's codebox. Experimenting with the really, really big selection of languages in the code block menu
ABAP
REPORT TEST.
WRITE 'Hello World'.
WRITE 'This is an example code in ABAP'.
* there are many keywords
* this is a COMMENT
* Keywords list:
* are, ABAP, an, abapOperator, abs, acos, ADD, ALIAS, ALIASES, AND, APPEND, APPENDING, AS etc...
* might add more soon
ADD 5 TO 7. " This is addition in ABAP, or atleast i think.
js
// this is javascript ^_^
// chatgpt really helped
function isPrime(number) {
if (number <= 1) {
return false;
}
for (let i = 2; i * i <= number; i++) {
if (number % i === 0) {
return false;
}
}
return true;
}
const num = 17;
if (isPrime(num)) {
console.log(num + " is a prime number.");
} else {
console.log(num + " is not a prime number.");
}
js+cheetah
// Import the CheetahJS library
import cheetah from 'cheetahjs';
// Define the ViewModel
const viewModel = {
firstName: 'John',
lastName: 'Doe',
fullName: function() {
return this.firstName + " " + this.lastName;
}
};
// Bind the ViewModel to the HTML
cheetah.bind(viewModel, document.getElementById('app'));