📝 Explain how code works in Set variable block
This commit is contained in:
@ -38,6 +38,27 @@ Compute a percentage:
|
|||||||
{{Score}} * 100 / {{Max Score}}
|
{{Score}} * 100 / {{Max Score}}
|
||||||
```
|
```
|
||||||
|
|
||||||
|
## Code
|
||||||
|
|
||||||
|
The code value should be written Javascript. It will read the returned value of the code and set it to your variable.
|
||||||
|
|
||||||
|
```js
|
||||||
|
const name = 'John' + 'Smith'
|
||||||
|
return name
|
||||||
|
```
|
||||||
|
|
||||||
|
If you don't provide the `return` keyword then it will be automatically prepended to the beginning of your code.
|
||||||
|
|
||||||
|
```js
|
||||||
|
'John' + 'Smith'
|
||||||
|
```
|
||||||
|
|
||||||
|
is the same as
|
||||||
|
|
||||||
|
```js
|
||||||
|
return 'John' + 'Smith'
|
||||||
|
```
|
||||||
|
|
||||||
## Current Date
|
## Current Date
|
||||||
|
|
||||||
You can create a `Submitted at` (or any other name) variable using this code:
|
You can create a `Submitted at` (or any other name) variable using this code:
|
||||||
|
Reference in New Issue
Block a user