if-else-statment.astro
· 379 B · Text
Raw
---
var UserLogin = false
---
<!-- Use this method if the results only returns "true" or "false" -->
{UserLogin ? <p>Log Out</p> : <p>Sign in</p>}
<!-- Use this method if the results return other results that are not labeled as "true" or "false -->
{
()=> {
if (UserLogin === "external") {
return <p>Log Out</p>
} else {
return <p>Sign In</p>
}
}
}
| 1 | --- |
| 2 | var UserLogin = false |
| 3 | --- |
| 4 | |
| 5 | <!-- Use this method if the results only returns "true" or "false" --> |
| 6 | {UserLogin ? <p>Log Out</p> : <p>Sign in</p>} |
| 7 | |
| 8 | <!-- Use this method if the results return other results that are not labeled as "true" or "false --> |
| 9 | { |
| 10 | ()=> { |
| 11 | if (UserLogin === "external") { |
| 12 | return <p>Log Out</p> |
| 13 | } else { |
| 14 | return <p>Sign In</p> |
| 15 | } |
| 16 | } |
| 17 | } |