Skip to content

Commit

Permalink
fix hello world to use felts + add felts concept
Browse files Browse the repository at this point in the history
  • Loading branch information
Nenad committed Jun 18, 2024
1 parent 0f2da19 commit 34ca622
Show file tree
Hide file tree
Showing 7 changed files with 27 additions and 6 deletions.
7 changes: 7 additions & 0 deletions concepts/felts/.meta/config.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"blurb": "<todo>",
"authors": [
"misicnenad"
],
"contributors": []
}
1 change: 1 addition & 0 deletions concepts/felts/about.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
# Felt Type
1 change: 1 addition & 0 deletions concepts/felts/introduction.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
# Introduction
10 changes: 10 additions & 0 deletions concepts/felts/links.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
[
{
"url": "https://book.cairo-lang.org/ch02-02-data-types.html#felt-type",
"description": "Felt type in the Cairo book"
},
{
"url": "https://starknet-by-example.voyager.online/getting-started/cairo_cheatsheet/felt.html",
"description": "Starknet by Example section on felts"
}
]
6 changes: 4 additions & 2 deletions config.json
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,8 @@
"name": "Hello World",
"uuid": "1a0e23d9-e8f9-493a-af46-2be040173b64",
"practices": [
"strings"
"strings",
"felts"
],
"prerequisites": [],
"difficulty": 1,
Expand All @@ -53,7 +54,8 @@
"name": "Leap",
"uuid": "9b586e17-928c-42bf-95ed-67539daea9a8",
"practices": [
"booleans"
"booleans",
"integers"
],
"prerequisites": [],
"difficulty": 1,
Expand Down
6 changes: 3 additions & 3 deletions exercises/practice/hello-world/src/lib.cairo
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// ByteArray is a string that's not limited to 31 characters, you'll learn more about this later
fn hello() -> ByteArray {
"Goodbye, Mars!"
// felt252, aka "field type", represents both a specific type of integer, and a string type that's limited to 31 characters
fn hello() -> felt252 {
'Goodbye, Mars!'
}

#[cfg(test)]
Expand Down
2 changes: 1 addition & 1 deletion exercises/practice/hello-world/src/tests.cairo
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#[test]
fn say_hi() {
assert_eq!(hello_world::hello(), "Hello, World!");
assert_eq!(hello_world::hello(), 'Hello, World!');
}

0 comments on commit 34ca622

Please sign in to comment.