A few suggestions regarding conditionals

It pretty much is.

“If (a) matches (b)” is like saying “if (a) contains (b)” where (a) is the test string and (b) is the expression to be contained/matched.

If (a) is “testing” and (b) is “test”, it would be true since “testing” matches test.

Now this is much more useful with Regular Expressions though – let’s suppose that (a) is “ski” and (b) is [aeiou]. In regex (and thus Hopscotch), this would return true because “ski” contains a vowel (one character in the subset [aeiou]). But, “sky” would return false since it does not contain a, e, i, o, or u.

5 Likes

But I think that can be done with regexp but itd be better as a block
(I think its [jeg])

1 Like

surprised no one saw the link to a slightly similar topic

2 Likes

Interesting. So this topic is still relevant?

2 Likes

The “contains” isn’t (since matches is that) but the “is pressed and <conditional>” certainly is still relevant

3 Likes

A feature I’d like to see in Hopscotch is: Extension of the ‘and’ block so that you can; for example, code something like:

When screen is pressed and self is touching circle, Set ‘random value’ to 10

I’d use it for this type of project: I have no idea to be honest, but any project that involves any kind of precise situations where something important should happen.

Here are some examples of Hopscotch code that could be improved if we had this: Something where something should activate when, let’s say screen is pressed and tilted at the same time.

Here is an example design I’ve made:

When(self is touching square 3)and(screen is pressed)
Set(value)to(10)

I’ve seen something similar in another programming languages, it looks like this: Well, no, mostly because I’m not coding especially much in other languages than Hopscotch.

What do you think?

8 Likes

Yes this would be a cool update

1 Like